Skip to content

Bamboo Weekly #180: Movies

Get better at: Working with CSV files, dates and times, grouping, pivot tables, and regular expressions

Bamboo Weekly #180: Movies

I'm back from EuroPython in Krakow, and while the news is full of current events from wildfires to inflation to the continuing war with Iran, a much-less modern story has been making headlines: The Odyssey, the new Christopher Nolan movie that critics are raving about. I haven't had a chance to see it yet, but I'm going to make an effort to do so in the coming weeks.

What's more, people are going to see the Odyssey in theaters, something that wasn't predicted during and after the covid-19 pandemic, which kept us all home and isolated, rather than in a crowded movie theater.

This got me wondering about how much the pandemic affected moviegoing, and how much theaters have bounced back since that time. And so, we'll examine data about movies, and particularly about movie theaters. Along the way, we'll look at which films and studios have done best, and what trends we're seeing.

Data and five questions

This week, we have data from two sources:

  1. First, we have a data dump of movie revenues per day in the United States from January 1st, 2000 through January 3rd, 2025. This data, from Box Office Mojo, was collected and assembled at the GitHub repo https://github.com/tjwaterman99/boxofficemojo-scraper. Information about this large .csv.gz file (https://github.com/tjwaterman99/boxofficemojo-scraper/releases/latest/download/revenues_per_day.csv.gz) are on that page.
  2. Second, we'll retrieve more recent daily data from Box Office Mojo using the boxoffice-api package (https://pypi.org/project/boxoffice-api/), whose get_daily method reads Box Office Mojo's daily chart. The package can optionally enrich each film with metadata (poster, plot, director, cast) from the OMDb API (https://www.omdbapi.com/) if you supply a free key — but that isn't needed for the revenue data here.

Paid subscribers, both to Bamboo Weekly and to my LernerPython+data membership program (https://LernerPython.com) get all of the questions and answers, as well as downloadable data files, downloadable versions of my notebooks, one-click access to my notebooks, and invitations to monthly office hours.

Learning goals for this week include working with APIs, combining data, dates and times, cleaning data, and grouping.

Here are my five questions for this week. I'll be back tomorrow with my solutions and explanations: