In this note, I use
df for DataFrame, s for Series.Group
df by column Region and then selct the column Western EuropeSelect just the
Happiness Score column and then find the meanApply multiple/custom functions,
If you wanna apply different functions on different columns,
Or using
apply and lambda function,Apply some functions,
Make values in one columns be columns in a new "pivot" table (ref)
For one who wanna know
display_side_by_side, check Jupyter notebook.Contrary to
pivot, we now want to transform several columns into values of a single column (ref).- Data Cleaning and Analysis on Dataquest.
- Transforming data with pandas on Dataquest.
- pandas official -- Group By: split-apply-combine