Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Where to put code to determine WHERE to read csv from?

$
0
0

So I need to read two csv files BUT I have to run code that selects the most recent one in a linux directory. Normally in Python I would simply put this code like this

if name == ‘main’:

latest_csv = get_latest_csv( the_csv_directory)

df_latest = pd.read_csv( latest_csv )

BUT I am hitting a problem. IF I put this code in a DASH app ( which works FINE if I hard code a csv file name) then the code below does NOT see the df_latest for some reason. Where am I supposed to put the code to designate any criteria needed to select the csv files?

html.Div([
dash_table.DataTable(
id=‘datatable_id’,
columns=[{“name”: i, “id”: i} for i in df_latest.columns],
data=df.to_dict(‘records’),

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles