Skip to content

Whether or not you like football, the Super Bowl is a spectacle. There's a little something for everyone at your Super Bowl party. Drama in the form of blowouts, comebacks, and controversy for the sports fan. There are the ridiculously expensive ads, some hilarious, others gut-wrenching, thought-provoking, and weird. The half-time shows with the biggest musicians in the world, sometimes riding giant mechanical tigers or leaping from the roof of the stadium.

The dataset we'll use was scraped and polished from Wikipedia. It is made up of three CSV files, one with game data, one with TV data, and one with halftime musician data for 52 Super Bowls through 2018.

The Data

Three datasets have been provided, and summaries and previews of each are presented below.

1. halftime_musicians.csv

This dataset contains information about the musicians who performed during the halftime shows of various Super Bowl games. The structure is shown below, and it applies to all remaining files.

ColumnDescription
'super_bowl'The Super Bowl number (e.g., 52 for Super Bowl LII).
'musician'The name of the musician or musical group that performed during the halftime show.
'num_songs'The number of songs performed by the musician or group during the halftime show.

2. super_bowls.csv

This dataset provides details about each Super Bowl game, including the date, location, participating teams, and scores, including the points difference between the winning and losing team ('difference_pts').

3. tv.csv

This dataset contains television viewership statistics and advertisement costs related to each Super Bowl.

# Import libraries
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
# Load the CSV data into DataFrames
super_bowls = pd.read_csv("datasets/super_bowls.csv")
super_bowls.head()
tv = pd.read_csv("datasets/tv.csv")
tv.head()
halftime_musicians = pd.read_csv("datasets/halftime_musicians.csv")
halftime_musicians.head()
# Start coding here
# Use as many cells as you need
sns.lineplot(data=tv, x='super_bowl', y='avg_us_viewers')
plt.show()
viewership_increased = True
viewership_increased
more_40 = (super_bowls['difference_pts'] > 40).value_counts().reset_index().sort_values('difference_pts', ascending=True)
more_40['difference_pts'] = more_40['difference_pts'].astype(int)
difference = more_40.iloc[0, 1]
difference
#Who performed the most songs in Super Bowl halftime shows?

num_songs = halftime_musicians.sort_values('num_songs', ascending=False)
most_songs = num_songs.iloc[0, 1]
most_songs
difference = len(super_bowls[super_bowls["difference_pts"]>40])
difference