Black Lives Matter. Please consider donating to Black Girls Code today.
Dash Enterprise delivers an incredible 21x cost savings 💸Download the e-book!

Unable to display a dataframe that is filtered with dropdowns

Hello! I am trying to display a dataframe that I created within the app.callback however whatever method I tried I got “Invalid prop for this component”. Looked some answers in the forum and changed my code according to those but I could not figure it out.

I tried creating dash tables, converting the dataframe to json file, html file, etc. But no luck. Lastly, I left it as without attempting to create a dash table.

Here is the code link: https://raw.githubusercontent.com/alpturkay96/dash_attempts/master/dashboard.py

Thank you!

Hi @alpturkay, have you tried to use Dash Datatable?

    div = html.Div([
        dash_table.DataTable(
            id='datatable',
            columns=[{"name": i, "id": i} for i in your_df.columns],
            data=your_df.to_dict('records'),
        )
    ])

Then return div and change the output property from figure to children.

Let me know if this what you are looking for. Good luck.

@HansPeter123 Thanks! I’ve tried using a dash datatable before but failed. Changed all the things you mentioned and it worked!

1 Like

I am happy I was able to help!