Template#
hvplotpanel
Published: January 20, 2022 · Updated: May 24, 2024
This is the template project. Its very first content must be a Markdown header (e.g. # My title
) and should be short and close to the project name.
import hvplot.pandas # noqa
import pandas as pd
import panel as pn
Data loading#
Loading some data.
df = pd.read_csv('data/penguins.csv')
df.head()
species | island | bill_length_mm | bill_depth_mm | flipper_length_mm | body_mass_g | sex | year | |
---|---|---|---|---|---|---|---|---|
0 | Adelie | Torgersen | 39.1 | 18.7 | 181.0 | 3750.0 | male | 2007 |
1 | Adelie | Torgersen | 39.5 | 17.4 | 186.0 | 3800.0 | female | 2007 |
2 | Adelie | Torgersen | 40.3 | 18.0 | 195.0 | 3250.0 | female | 2007 |
3 | Adelie | Torgersen | NaN | NaN | NaN | NaN | NaN | 2007 |
4 | Adelie | Torgersen | 36.7 | 19.3 | 193.0 | 3450.0 | female | 2007 |
Analysis#
Creating an interactive pipeline.
dfi = df.interactive()
w_island = pn.widgets.Select(options=list(df['island'].unique()))
pipeline = (
dfi[dfi['island'] == w_island]
.hvplot
.scatter(x='bill_length_mm', y='bill_depth_mm', by='species', width=400)
)
pipeline
Panel app#
When the full application is not meant to be displayed in the notebook, or when it is known to affect the notebook’s CSS (as in this case wrapping it in a template), it is useful to suppress the cell output with ;
.
pn.template.FastListTemplate(
sidebar=[pipeline.widgets()],
main=[pipeline.panel()],
title='Template Application'
).servable();
This web page was generated from a Jupyter notebook and not all
interactivity will work on this website.