these errors are the ones that appear to me
Hello good morning, I have a problem with the callbacks of my code. At first I had problems because I was using dash table experiments, then I switched to dash table and managed to get the page to work but it shows me those errors. What could cause these errors?
@app.callback(
Output('map-graph', 'figure'),
[Input('datatable', 'data'),
Input('datatable', 'selected_rows')],
[State('map-graph', 'figure')])
def map_selection(self, selected_rows, data):
aux = pd.DataFrame(data)
temp_df = aux.ix[selected_rows, :]
if len(selected_rows) == 0:
return gen_map(aux)
return gen_map(temp_df)
@app.callback(
Output('datatable', 'data'),
[Input('ACTIVITY', 'value'),
Input('STATE', 'value')],
[State('datatable', 'data')])
def update_selected_rows(ACTIVITY, STATE):
map_aux = map_data.copy()
# Filter type
map_aux = map_aux[map_aux['ACTIVITY'].isin(ACTIVITY)]
# District filter
map_aux = map_aux[map_aux["STATE"].isin(STATE)]
rows = map_aux.to_dict('records')
return rows
@app.callback(
Output('bar-graph', 'figure'),
[Input('datatable', 'data'),
Input('datatable', 'selected_rows')],
[State('bar-graph', 'figure')])
def update_figure(data, selected_rows, figure):
dff = pd.DataFrame(data)
layout = go.Layout(
bargap=0.05,
bargroupgap=0,
barmode='group',
showlegend=False,
dragmode="select",
xaxis=dict(
showgrid=False,
nticks=50,
fixedrange=False
),
yaxis=dict(
showticklabels=True,
showgrid=False,
fixedrange=False,
rangemode='nonnegative',
zeroline='hidden'
)
)
data = Data([
go.Bar(
x=dff.groupby('STATE', as_index=False).count()['STATE'],
y=dff.groupby('STATE', as_index=False).count()['ACTIVITY']
)
])
return go.Figure(data=data, layout=layout)
question from:
https://stackoverflow.com/questions/65905197/callback-error-typeerror-update-selected-rows-takes-2-positional-arguments-bu 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…