Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Unable to do call backs on cards

$
0
0

I am having difficulty in Call backs on card as I am pretty new to this, I have been taking data from different sources to update my dashboard but Card is where I am stuck.

dash.exceptions.InvalidCallbackReturnValue: The callback for <Output sls.children>
returned a value having type DataFrame
which is not JSON serializable.

The value in question is either the only value returned,
or is in the top level of the returned list,

and has string representation
Empty DataFrame Columns: [year, Net Sale, Winnings, Revenue] Index: []

In general, Dash properties can only be
dash components, strings, dictionaries, numbers, None,
or lists of those.


def update_card(select_month):
    if type(select_month)!=str:
        df_new3=df_filtered[df_filtered['year'].isin(select_month) ]
    else:
        df_new3=df_filtered[df_filtered['year']==select_month]
    return df_new3

    card = dbc.Card([
        dbc.CardBody([
            html.P(f'otal Sales{select_month}',df_new3, id='sls')
        ])
    ])
    

if __name__ =='__main__':
    app.run_server(debug=True)

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles