Calling Table inside function

def make_dash_table(df):
return html.Div([html.H4(‘DataTable’),
dt.DataTable(
rows=df.to_dict(‘records’),
),])

It says : Type Error Object of type ‘DataFrame’ is not JSON serializable.

How can I create table this way inside function

If I am not mistaken, which I am sometimes :slightly_smiling_face:, this should help:
You need to return something like;

return df.to_json(orient='split')

, instead of your df.to_dict.

Same ERROR!
Type Error Object of type ‘DataFrame’ is not JSON serializable.

How are you calling make_dash_table?