I have the following code, which works as intended except for the fact that if I paste all the code in the same Jupyter cell it won’t work:
How can I adjust the code such that I can immediately access
df in the same Jupyter cell?
Code as text:
import panel as pn import pandas as pd from io import BytesIO pn.extension() uploadFile = pn.widgets.FileInput(accept=".csv") def get_data_from_file(file): if file is not None: df = pd.read_csv(BytesIO(file)) return df get_df = pn.bind(get_data_from_file, uploadFile) df = get_df()