Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Reference Pandas dataframe in app.py dash file

I have a jupyter notebook .ipynb that includes the code I wrote to generate some data and a pandas dataframe.

24

I need to deploy a web app that renders the location data and allows users to perform some basic analysis. I think Dash Framework offers everything that I need!

My question is how do I reference the pandas dataframe in app.py file.

I need my application code (app.py file) to reference the pandas dataframe from the python notebook file and parse the location data to display on a map/create visualization.

Hi @keval

You could write the pandas dataframe to .csv https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_csv.html from your notebook and then read in the .csv in your app.py file https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html. Plotly has a few examples in the gallery https://dash.plot.ly/gallery - you can click source code to view the app.py file for each of these examples.

Thanks, @bcd - I think that’ll work for me.