Exercise: Group By Aggregations
This exercise will test your abilitiy to do group by aggregations on a pandas data frame
We'll cover the following
Group by aggregations #
We’ll use the same function we created in the Reading Data exercise to read in the pandas
data frame.
We will create an additional function group_aggregation
which will take a data frame, a group variable, and an aggregation variable. The function will group by the group variable and calculate the mean of the aggregation variable for each group. Your function will return the grouped data frame.
Try to implement the function below. Feel free to view the solution, after giving it a few shots. Good Luck!
Get hands-on with 1200+ tech skills courses.