Hi
I have Dashboard which uses data from Pandas df. It is one table on which I want to provide 3 filters. One for COUNTRY, second for STATE And Gender . Below is a code (only problematic part shown) which I am using
@app.callback(
dash.dependencies.Output(‘table-container’, ‘children’),
[dash.dependencies.Input(‘dropdown’, ‘value’),
dash.dependencies.Input(‘dropdown1’, ‘value’),
dash.dependencies.Input(‘dropdown2’, ‘value’)])
def display_table(dropdown_value,dropdown1_value,dropdown2_value):
df = pd.read_csv(r’Dashboard Input Sample1.csv’)
if dropdown_value is None and dropdown1_value is None and dropdown2_value is None:
#print(dropdown1_value)
#print(dropdown_value)
return generate_table(df)
elif dropdown1_value is None:
print(dropdown_value)
df =df[df['Usage_Segment'] == dropdown_value]
return generate_table(df)
elif dropdown_value is None:
print(dropdown1_value)
df =df[df['RFM_Segment'] == dropdown1_value]
return generate_table(df)
#elif dropdown_value is None and dropdown1_value is None:
# print(dropdown2_value)
# df =df[df['Churn_Category'] == dropdown2_value]
# return generate_table(df)
else:
df =df[df['Usage_Segment'] == dropdown_value]
df =df[df['RFM_Segment'] == dropdown1_value]
#df =df[df['Churn_Category'] == dropdown2_value]
return generate_table(df)
#if dropdown1_value is None:
# return generate_table(df)