From the course: Python Data Analysis
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Comparing name popularity - Python Tutorial
From the course: Python Data Analysis
Comparing name popularity
- [Instructor] We are ready to start analyzing this data. How we load and look at the combined data frame we just created. We want to examine the change in popularity of a name. So we need to reframe the data in a way, that will make this easier. We will use a multi-index. We will index the date on sex first, then name, and then year. And we will also sort the index. Getting the data for any given name is then a simple exercise of indexing with dot loc. For instance Mary, this series is ready to plot. Notice how Metro-lib automatically uses the index to set the x-axis. We see two peaks. At approximately 1920 and 1950. It probably makes sense also to consider the frequency of a name as a fraction of the number of babies born in a year. To get that, we can apply group by on the un-indexed data frame and take the sum. Then we can normalize Mary by all the newborns in every year. So as a percentage of all…
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.