What a strange thing!
I’ve been making my callbacks as per the guidance of the documentation.
I bumped into one that does not work, it presents the return below:
c:\Users\EliasPai\Documents\RIKA\ProjetoDashRika\app.py:2: UserWarning:
The dash_html_components package is deprecated. Please replace
import dash_html_components as html
with from dash import html
import dash_html_components as html
Traceback (most recent call last):
File “c:\Users\EliasPai\Documents\RIKA\ProjetoDashRika\app.py”, line 424, in
@cc.callback(Output(‘card_venda’, ‘children’),
TypeError: CallbackBlueprint.callback() takes from 3 to 4 positional arguments but 8 were given
What could I be doing wrong here?
@cc.callback(Output('card_venda', 'children'),
Input("store", "data"),
Input('year-slider', 'value'),
Input('drop-cidade', 'value'),
Input('check-inline-mes', 'value'),
Input(ThemeSwitchAIO.ids.switch("theme"), "value"),
Input('drop-bairro', 'value'),)
def update_card_venda(df, date, dropdown_cidade, mes, toggle, dropdown_bairro):
template = template_theme1 if toggle else template_theme2
#df_dados_gerais = dataframe()
if 'TODAS' in dropdown_cidade:
mask = (df['ANO'] == date) & (df['MES'].isin(mes))
else:
mask = (df['ANO'] == date) & (df['CIDADE'].isin(dropdown_cidade)) & \
(df['BAIRRO'].isin(dropdown_bairro)) & (df['MES'].isin(mes))
df_vendas = df[(df['OPERACAO'] == 'V') & (df['CANCELADO'] != '*')].loc[mask]
venda_bruta = df_vendas['TOTAL_OPERACAO'].sum()
return f'Vendas: R${venda_bruta:_.2f} '.replace('.', ',').replace('_', '.')