Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

Plotly Express in python timeout issue

my code works final locally but I keep getting timed out when I try to upload this data to Heroku I figure it is because of how big the csv file and all the date it has to read. do y’all have an idea how to fix this issue?

import dash
import plotly.express as px
import dash_html_components as html
import dash_core_components as dcc
import pandas as pd
data = pd.read_csv(‘data45.csv’)
fig = px.scatter(data, x=‘COVID Cases’, y=“Workplace Travel”,
animation_frame=‘Date’, animation_group=‘FIPS’, symbol=‘Masks’,
size=‘Population’, color=‘State’, hover_name=‘County’,
range_x=[1, 200000], range_y=[-90, 50], log_x=True)
fig.update_layout(template=‘plotly_white’)
fig.update_layout(title=‘COVID cases and Workplace Travel by County in US’)
app = dash.Dash()
server = app.server
app.layout = html.Div(children=[
html.Div(“Covid-19”,style={“text-align”: “center”, “font-size”: “40px”, “border-bottom-style”:“solid”,
“width”:“100%”,}),
html.Div(dcc.Graph(id=‘map’,figure=fig))
])
if name == ‘main’:
app.run_server()

Hi @mathguy ,

Indeed, I think this has to do with the size of your csv. I have run into a similar issue before. I believe the issue is not the size of the csv - provided it does not exceed your heroku limit (which is 500MB on their free service option) - but rather the data being sent clientside that is causing the timeout.

I overcame it using a pandas dataframe. Only the data that was would be visible in the current layout of the scatterplot was transmitted clientside. I am no expert on this stuff though, perhaps someone else could shed some light.

Welcome to the community, @mathguy. :slight_smile: