June 2017
Beginner to intermediate
576 pages
15h 22m
English
In many instances, we will only want to look at the top categories, especially when there are many demographical categories that have been subsetted. In this example, there are only 24 categories but in other examples, there may be a much larger number of categories.
The dataframe x2 is already sorted by Avg.People. Since we know that there are 14 enrollment records for each category, we can get the top 10 categories based upon the highest base population by selecting the first 14*10 (or 140) rows. We will store this in a new dataframe, x3, and save this to disk.
Since we know each group has 14 years, extracting the top 10 groups is easy to calculate. After assigning x2, print ...