Thanks so much for the response Quentin. I applied your suggestion and the weird thing is that the datatable is not updating. However, I can tell by looking through the Terminal that the code is working. Also, my datatable is not displaying the index (index is datetime). Something has got to be off with how I’ve set up the data table to read in the data? Full code below:
df = pd.read_csv('Test_Time_Series.csv')
df['Date'] = pd.to_datetime(df.Date,errors='coerce')
df.index = df['Date']
del df['Date']
app = dash.Dash()
app.layout = html.Div([
dcc.DatePickerRange(
id='my-date-picker-range',
min_date_allowed=dt(2019, 1, 1),
max_date_allowed=dt(2019, 1, 4),
initial_visible_month=dt(2019, 1, 1),
end_date=dt(2019, 1, 4)
),
dash_table.DataTable(
id='table',
columns=[{"name": i, "id": i} for i in df.columns],
data=df.to_dict("rows")
)
])
@app.callback(
dash.dependencies.Output('table', 'data'),
[dash.dependencies.Input('my-date-picker-range', 'start_date'),
dash.dependencies.Input('my-date-picker-range', 'end_date')])
def update_table(start_date, end_date):
df2 = df.loc[start_date: end_date]
return df2
if __name__ == '__main__':
app.run_server(debug=True)