1. Welcome!
.
The Office! What started as a British mockumentary series about office culture in 2001 has since spawned ten other variants across the world, including an Israeli version (2010-13), a Hindi version (2019-), and even a French Canadian variant (2006-2007). Of all these iterations (including the original), the American series has been the longest-running, spanning 201 episodes over nine seasons.
In this notebook, we will take a look at a dataset of The Office episodes, and try to understand how the popularity and quality of the series varied over time. To do so, we will use the following dataset: datasets/office_episodes.csv
, which was downloaded from Kaggle here.
This dataset contains information on a variety of characteristics of each episode. In detail, these are:
- episode_number: Canonical episode number.
- season: Season in which the episode appeared.
- episode_title: Title of the episode.
- description: Description of the episode.
- ratings: Average IMDB rating.
- votes: Number of votes.
- viewership_mil: Number of US viewers in millions.
- duration: Duration in number of minutes.
- release_date: Airdate.
- guest_stars: Guest stars in the episode (if any).
- director: Director of the episode.
- writers: Writers of the episode.
- has_guests: True/False column for whether the episode contained guest stars.
- scaled_ratings: The ratings scaled from 0 (worst-reviewed) to 1 (best-reviewed).
1. Import required libraries
# Import modules
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = [11, 7] # Set figure size
# Plotting style
plt.style.use('fivethirtyeight')
2. Load and read the data
filepath = 'datasets/office_episodes.csv'
df = pd.read_csv(filepath)
# Print first 5 rows of the data
df.head()
3. Explore the data
A. Overview of the data
df.info()
B. Summary statistics
df.describe()
C. Investigate for missing values
df.isna().sum()
df['guest_stars'].value_counts()
df[df['guest_stars'].isna()]
It looks like the missing values for the Office Episodes data on the 'guest_stars'
can be justified since there won't always be guest stars for every episode in a TV show.