From the course: pandas Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution
- [Instructor] So, let's import Pandas and read the CSV file into our DataFrame 00. So, using Groupby, plot the total number of medal awarded at each of the Olympic Games throughout history. So, this is the same question that we looked at in the indexing challenge and here's another way to get the same result using Groupby. So, 00's my DataFrame. I'm going to Groupby the edition and I'm going to use the size object to determine the count for each group and let's see what we get here. So, unlike in indexing, we see that Groupby sorts the index by default and so, we can see it's 1896 to 1900 and so on and all of the years here are sorted by the Olympic year, so we don't have to use these sort index like we had to in the indexing example. So, all I need to do now is to just plot this line and we end up with exactly the same result as we did in the indexing challenge. Onto the next question. Create a list showing the total number of medals, one for each country over the history of the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.