The dataframe is an empty df after query.when groupby,raise runtime waring,then get another empty dataframe with no columns.How to keep the columns?
df = pd.
You need as_index=False and group_keys=False:
as_index=False
group_keys=False
df = df.groupby(["PlatformCategory","Platform","ResClassName"], as_index=False).count() df Empty DataFrame Columns: [PlatformCategory, Platform, ResClassName, Amount] Index: []
No need to reset your index afterwards.