Your comment was of great help to me, thank you, I was able to solve the problem by changing the code in the parts that you recommended, something like this was left.
app = dash.Dash(__name__)
app.layout = html.Div(children=[
html.H1(children='Analisis de reingresos'),
html.Div([
html.Div(children=[
html.Label('Seleccione Motivo'),
dcc.Dropdown(
id='dropdown',
#options=[{'label': i, 'value': i} for i in options],
options=[{'label':h, 'value':h} for h in aaa6['Motivo'].unique()],
searchable=True,
value='NA',
multi=True
)],style={'width': '25%', 'display': 'inline-block'}),
html.Div(children=[
html.Label('Seleccione tipo de personal'),
dcc.Dropdown(
id='dropdowntp',
#options=[{'label': i, 'value': i} for i in options],
options=[{'label':h, 'value':h} for h in aaa6['Tipopersonal'].unique()],
value='NA',
multi=True,
searchable=True
)], style={'width': '25%', 'display': 'inline-block'}),
html.Div(children=[
html.Label('Seleccione Centro de Costo'),
dcc.Dropdown(
id='dropdowncc',
#options=[{'label': i, 'value': i} for i in options],
options=[{'label':c, 'value':c} for c in aaa6['Ncc'].unique()],
value='NA',
multi=True
)], style={'width': '25%', 'display': 'inline-block'}),
html.Div(children=[
html.Label('Seleccione bodega'),
dcc.Dropdown(
id='dropdownb',
#options=[{'label': i, 'value': i} for i in options],
options=[{'label':c, 'value':c} for c in aaa6['Nombre Bodega'].unique()],
value='NA',
multi=True
)], style={'width': '25%', 'display': 'inline-block'}),
html.Div(dcc.Graph(id='graph')),
]),
])
@app.callback(
Output('graph', 'figure'),
Input('dropdown','value'),
Input('dropdowntp','value'),
Input('dropdowncc','value'),
Input('dropdownb','value'),
)
def update_graph(dropdown,dropdowntp,dropdowncc,dropdownb):
dff = aaa6.copy()
#motivo de reingreso
if not dropdown or 'NA' in dropdown :
dff['Motivo'] = aaa6['Motivo']
else:
if dropdown != "NA":
dff = dff[dff['Motivo'].isin(dropdown)]
#tipo de personal
if not dropdowntp or 'NA' in dropdowntp:
dff['Tipopersonal'] = aaa6['Tipopersonal']
else:
if dropdowntp != "NA":
dff = dff[dff['Tipopersonal'].isin(dropdowntp)]
#centro de costo
if not dropdowncc or 'NA' in dropdowncc:
dff['Ncc'] = aaa6['Ncc']
else:
if dropdowncc != "NA":
dff = dff[dff['Ncc'].isin(dropdowncc)]
#bodega
if not dropdownb or 'NA' in dropdownb:
dff['Nombre Bodega'] = aaa6['Nombre Bodega']
else:
if dropdownb != "NA":
dff = dff[dff['Nombre Bodega'].isin(dropdownb)]
figure222=px.bar(dff, x="Motivo", y="cantidadreingresada", color="Motivo", title='Personal que mas reingresa')
return figure222
if __name__ == '__main__':
app.run_server(debug=False, port=8000)