Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Display dataframe with groupby in DashTable

So, I have a dataframe that displays correctly in my Notebook but not in a *.py dash app when the datafram is loaded into a DashTable. It appears that the “Grouped By” column is not displaying in the DashTable.

Has anyone run ito this?

Here’s how it looks in my notebook:

Here’s how the DataTable looks:

Here’s how the dataframe is created:

df3 = df.groupby(‘Game_SK’).agg(np.sum)
df3[“Goal_Diff”] = (df3[“Goals”] - df3[“Goals Allowed”])
conditions = [df3[‘Goal_Diff’] > 0, df3[‘Goal_Diff’] == 0, df3[‘Goal_Diff’] < 0]
choices = [‘Win’, ‘Tie’, ‘Loss’]
df3[‘Result’] =, choices)

Here’s how it’s passed to the DataFrame:

            id = 'datatable2',
            columns = [{"name": i, "id": i} for i in df3.columns],

What am I missing? Sometype of Index property?

Thank you in advance for your insight.

Joe P.

The easiest way to display it would be to call reset_index(drop=True) on the data frame after your group by.

1 Like

On top of what @Croll12 said, you can highlight your groupby column by using conditional formatting to change the fontWeight to bold (for example).

Thanx team. I got it working now. Great advice.