pandas groupby return dataframe code example
Example 1: pandas new df from groupby
df = pd.DataFrame(old_df.groupby(['groupby_attribute'])['mean_attribute'].mean())
df = df.reset_index()
df
Example 2: pandas print groupby
grp = df.groupby['colName']
grp.describe()