import pandas as pd
from IPython.core import display as ICD
df = pd.DataFrame({'area': [5, 42, 20, 20, 43, 78, 89, 30, 46, 78], 'cost':
    [52300, 52000, 25000, 61600, 43000, 23400, 52300, 62000, 62000, 73000],
    'grade': [1, 3, 2, 1, 2, 2, 2, 4, 1, 2], 'size': [1045, 957, 1099, 1400,
    1592, 1006, 987, 849, 973, 1005], 'team': ['man utd', 'chelsea',
    'arsenal', 'man utd', 'man utd', 'arsenal', 'man utd', 'chelsea',
    'arsenal', 'arsenal']})
result = df.groupby(['team', 'grade']).agg({'cost': 'mean', 'area': 'mean',
    'size': 'sum'}).rename(columns={'cost': 'mean_cost', 'area': 'mean_area'})
dfs = {team: grp.drop('team', axis=1) for team, grp in result.reset_index()
    .groupby('team')}
for team, grp in list(dfs.items()):
    print(team)
ICD.display(grp)
Pandas: How to reference and print multiple dataframes as HTML tables