# dcc.DatePickerRange error

**URL:** <https://community.plotly.com/t/dcc-datepickerrange-error/35124>\
**Category:** Dash Python\
**Created:** [February 18, 2020, 4:08pm UTC](https://community.plotly.com/t/dcc-datepickerrange-error/35124 "2020-02-18T16:08:02Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![IceOriental123](https://avatars.discourse-cdn.com/v4/letter/i/b5e925/32.png) [@IceOriental123](https://community.plotly.com/u/IceOriental123)\
**Post date:** [February 18, 2020, 4:40pm UTC](https://community.plotly.com/t/dcc-datepickerrange-error/35124/3 "2020-02-18T16:40:55Z")

</div>

Hello!

Thanks, that solved that issue, but the code still doesn’t work. Do you mind taking a look at my callbacks and seeing why? Im new to this so expect basic errors.

before callbacks

> app = dash.Dash( **name** )  
> df = pd.read\_csv(‘data/dashboard\_data.csv’)  
> PAGE\_SIZE = 10  
> app.layout [see above]

callbacks

> @app.callback(  
> Output(‘table-sorting-filtering’, ‘data’),  
> [Input(‘table-sorting-filtering’, “page\_current”),  
> Input(‘table-sorting-filtering’, “page\_size”),  
> Input(‘table-sorting-filtering’, ‘sort\_by’),  
> Input(‘table-sorting-filtering’, ‘filter\_query’),  
> Input(‘interval\_component’, ‘n\_intervals’),  
> Input(‘my-date-picker-range’, ‘start\_date’),  
> Input(‘my-date-picker-range’, ‘end\_date’)])
> 
> def update\_table(page\_current, page\_size, sort\_by, filter, n\_intervals, start\_date, end\_date):  
> filtering\_expressions = filter.split(’ && ')  
> dff = df  
> for filter\_part in filtering\_expressions:  
> col\_name, operator, filter\_value = split\_filter\_part(filter\_part)  
> if operator in (‘eq’, ‘ne’, ‘lt’, ‘le’, ‘gt’, ‘ge’):  
> # these operators match pandas series operator method names  
> dff = dff.loc[getattr(dff[col\_name], operator)(filter\_value)]  
> elif operator == ‘contains’:  
> dff = dff.loc[dff[col\_name].str.contains(filter\_value)]  
> elif operator == ‘datestartswith’:  
> # this is a simplification of the front-end filtering logic,  
> # only works with complete fields in standard format  
> dff = dff.loc[dff[col\_name].str.startswith(filter\_value)]  
> if len(sort\_by):  
> dff = dff.sort\_values(  
> [col[‘column\_id’] for col in sort\_by],  
> ascending=[  
> col[‘direction’] == ‘asc’  
> for col in sort\_by  
> ],  
> inplace=False  
> )  
> return dff.iloc[  
> page\_current\*page\_size:(page\_current+ 1)\*page\_size  
> ].to\_dict(‘records’)
> 
> def update\_rows(n\_intervals, n\_clicks):  
> data = pd.read\_csv(‘data/dashboard\_data.csv’)  
> dict = data.to\_dict(‘records’)  
> return dict
> 
> def update\_data(start\_date, end\_date):  
> df2 = df.loc[start\_date: end\_date]  
> data = df2.to\_dict(“rows”)
> 
> ```
> return data
> 
> ```
> 
> @app.callback(  
> Output(‘output-container-date-picker-range’, ‘children’),  
> [Input(‘my-date-picker-range’, ‘start\_date’),  
> Input(‘my-date-picker-range’, ‘end\_date’)])  
> def update\_output(start\_date, end\_date):  
> string\_prefix = ‘You have selected: ’  
> if start\_date is not None:  
> start\_date = dt.strptime(start\_date.split(’ ‘)[0], ‘%Y-%m-%d’)  
> start\_date\_string = start\_date.strftime(’%B %d, %Y’)  
> string\_prefix = string\_prefix + ‘Start Date: ’ + start\_date\_string + ’ | ’  
> if end\_date is not None:  
> end\_date = dt.strptime(end\_date.split(’ ‘)[0], ‘%Y-%m-%d’)  
> end\_date\_string = end\_date.strftime(’%B %d, %Y’)  
> string\_prefix = string\_prefix + 'End Date: ’ + end\_date\_string  
> if len(string\_prefix) == len('You have selected: '):  
> return ‘Select a date to see it displayed here’  
> else:  
> return string\_prefix
> 
> @app.callback(  
> Output(‘table’, ‘columns’),  
> [Input(‘my-date-picker-range’, ‘start\_date’),  
> Input(‘my-date-picker-range’, ‘end\_date’)])  
> def update\_columns(start\_date, end\_date):  
> df2 = df.loc[start\_date: end\_date]  
> columns =[{“name”: i, “id”: i} for i in df2.columns]
> 
> ```
> return columns
> 
> ```

code for the callbacks are taken from ([https://dash.plot.ly/dash-core-components/datepickerrange](https://dash.plot.ly/dash-core-components/datepickerrange)) and qdumount’s answer here ([DatePickerRange to Update Data Table - #4 by Troy](https://community.plotly.com/t/datepickerrange-to-update-data-table/16193/4)). personally im not sure if the df2 above in callbacks is right.

the error in terminal is

> dash.exceptions.NonExistentIdException:  
> Attempting to assign a callback to the  
> component with the id “table” but no  
> components with id “table” exist in the  
> app’s layout.
> 
> ```
> Here is a list of IDs in layout:
> 
> ```
> 
> [‘table-sorting-filtering’, ‘my-link’, ‘my-date-picker-range’, ‘output-container-date-picker-range’, ‘table-paging-with-graph-container’, ‘interval\_component’]
> 
> ```
> If you are assigning callbacks to components
> that are generated by other callbacks
> (and therefore not in the initial layout), then
> you can suppress this exception by setting
> `suppress_callback_exceptions=True`.
> 
> ```

---

_[View the full topic](https://community.plotly.com/t/dcc-datepickerrange-error/35124)._
