I have a dataframe, I want to
FROM: dow yield 0 F 2 1 F 3 2 M 4 3 M 6
First column is index, so you can add parameter as_index=False:
index
as_index=False
df1 = df.groupby('dow', as_index=False).sum() print (df1) dow yield 0 F 5 1 M 10 2 TH 7
Or reset_index:
df1 = df.groupby('dow').sum().reset_index() print (df1) dow yield 0 F 5 1 M 10 2 TH 7