Several years ago, my city's health department put out a general alert, telling anyone who had been to a particular supermarket that they had been exposed to measles, and should go ASAP to the local health ministry office for a vaccine booster. We've been ordering groceries online for more than 20 years, but as luck would have it, I was actually in that supermarket on that day. So off I went to the health ministry, where a very patient, knowledgeable nurse gave me the booster.
From the nurse, I learned that measles is extremely contagious; one infected employee had been at that supermarket for just a few hours, but the measles virus would apparently remain in the air, and able to affect people, for many hours afterwards. Plus, all you need is a handful of unvaccinated people to start spreading measles around. Then you end up affecting not just the unvaccinated, but some (small but non-zero) number of vaccinated people, as well as (and including) the elderly and people whose immune systems have been compromised.
I mention this in the context of a measles outbreak that is happening in the United States, particularly in Texas. More than 180 people have contracted measles so far this year, and one of them died. According to the CDC, 95 percent of those who came down with measles were unvaccinated.
This is happening at the same time as the Trump administration is defunding and silencing large parts of the federal government, including places like the Centers for Disease Control (CDC), which tracks, reports on, and warns about measles and other diseases.
Add to this the fact that Robert F. Kennedy, Jr., the current secretary for health and human services, is a long-time opponent of vaccines. Indeed, it seems that when Kennedy recently spoke about the seriousness of the measles outbreak, he conveniently forgot to mention that people can protect themselves by getting vaccinated (https://www.nytimes.com/2025/03/02/health/measles-vaccination-texas-kennedy.html?unlocked_article_code=1.1k4.U9NP.ZEZHIuIJRT_H&smid=url-share).
Fortunately, the CDC is still providing data and updates regarding measles. This week, we'll look at some of data.
Data and six questions
The main page for measles-related data at the CDC is https://www.cdc.gov/measles/data-research/ . That's where you can see an up-to-date indication of how many people have been infected, how many of them were unvaccinated, and how many people died from the disease.
From that page, you can also download a number of data sets in CSV format, just after each of the relevant charts, maps, and graphs.
This week, I have six tasks and questions for you to answer. Learning goals (tagged at the top of this message) include working with CSV files, working with dates and times, pivot tables, and plotting.
Paid subscribers can download the data files from a link at the bottom of this message.
I'll be back tomorrow with my solutions, including (for paid subscribers) a downloadable copy of the Jupyter notebook I used to solve these problems, as well as a one-click link to open that notebook (and the data) in Google Colab.
Here are my six tasks and questions:
- Read the "weekly cases by onset date" into a data frame. Create a line plot comparing the
week_start
column with the number of cases. Would the recent outbreak in the US seem to fit the usual pattern, or is this an unusually high number of cases? - The CDC says that measles isn't a seasonal disease. Let's try to see that visually, using data from 2023 and 2024: Create a new line plot, whose x axis represents the months of the year. Plot the number of cases from each 2023 and 2024 using a separate line, in a different color. Do we see any obvious common peaks or dips between the two years?