Screen Link: https://app.dataquest.io/m/343/data-aggregation/9/introduction-to-the-agg-method
My Code:
import numpy as np
grouped = happiness2015.groupby('Region')
happy_grouped = grouped['Happiness Score']
def dif(group):
return (group.max() - group.mean())
mean_max_dif = happy_grouped.agg(dif)
print(mean_max_dif)
I expected the the column name to be be dif
, but it is named “Happines Score” why is that?