Black Lives Matter. Please consider donating to Black Girls Code today.

Rangeslider callback with df.column slicing

Hi guys,

I am currently building an app which uses a dcc.Rangeslider components which marks which represent months and i intend to be able to slice by data based on this but the Rangslider gives me some issues for concern.

Any help will be appreciated.Below is my code:


I am using a dataframe whose columns happen to be my datetime values so i will be slicing my data on the columns using .loc[:,start:end] my callback

@app.callback Out(‘count’,'children),[Input(‘gender’,‘value’),Input(‘Rangeslider’,'value)])
def set_count(gender,rangeslider):
return df.loc[str(gender)].sum()

Can someone please explain to me why the call back doesnt work.

Hi @Jason4
can you please put your code into preformatted text and share the dataframe/.csv file with us (or an example of a few rows and columns). It would be easier to help if I could play around with it a little.