Hello – I am very new to Holoviz and Panel. I would like to create a dashboard that lets a user select the data file and then creates plots based on the data in the selected file. The code below creates the interactive object.
interactive_file should still have the DataFrame as the underlaying object. You should be able to access pandas methods with interactive_file. <press tab>.
You can work with the interactive_file as if it was a DataFrame. Then you can decide whether to display the .widgets, the .panel or both.
Here is an example
import panel as pn
import pandas as pd
import hvplot.pandas
pn.extension()
file_selection = pn.widgets.Select(options=["file1", "file2"])
def get_data_from_file(file):
return pd.DataFrame({
file: [1,2]
})
interactive_file = hvplot.bind(get_data_from_file, file_selection).interactive()
## Here we continue transforming the data
def transform(df):
return df+2
transformed_df = interactive_file.pipe(transform)
## Layout stuff: You can get the .widgets only or the .panel only
pn.Column("## All", interactive_file, "## Transformed Widgets", transformed_df.widgets(), "## Transformed Panel", transformed_df.panel()).servable()