December 2018
Beginner to intermediate
682 pages
18h 1m
English
In order for this recipe to complete properly, we need to first filter for institutions that do not have missing values for UGDS, SATMTMID, and SATVRMID. By default, the dropna method drops rows that have one or more missing values. We must use the subset parameter to limit the columns it looks at for missing values.
In step 2, we define a function that calculates the weighted average for just the SATMTMID column. The weighted average differs from an arithmetic mean in that each value is multiplied by some weight. This quantity is then summed and divided by the sum of the weights. In this case, our weight is the undergraduate student population.
In step 3, we pass this function to the apply method. Our function weighted_math_average ...