Netflix Top 10: Analyzing Weekly Chart-Toppers
This dataset comprises Netflix's weekly top 10 lists for the most-watched TV shows and films worldwide. The data spans from June 28, 2021, to August 27, 2023.
This workspace is pre-loaded with two CSV files.
netflix_top10.csv
contains columns such asshow_title
,category
,weekly_rank
, and several view metrics.netflix_top10_country.csv
has information about a show or film's performance by country, contained in the columnscumulative_weeks_in_top_10
andweekly_rank
.
We've added some guiding questions for analyzing this exciting dataset! Feel free to make this workspace yours by adding and removing cells, or editing any of the existing cells.
Explore this dataset
To get you started with your analysis...
- Combine the different categories of top 10 lists in a single weekly top 10 list spanning all categories
- Are there consistent trends or patterns in the content format (tv, film) that make it to the top 10 over different weeks or months?
- Explore your country's top 10 trends. Are there unique preferences or regional factors that set your country's list apart from others?
- Visualize popularity ranking over time through time series plots
π Scenario: Understanding the Impact of Content Duration on Netflix's Top 10 Lists
This scenario helps you develop an end-to-end project for your portfolio.
Background: As a data scientist at Netflix, you're tasked with exploring the dataset containing weekly top 10 lists of the most-watched TV shows and films. For example, you're tasked to find out what the relationship is between duration and ranking over time. Answering this question can inform content creators and strategists on how to optimize their offerings for the platform.
Objective: Determine if there's a correlation between content duration and its likelihood of making it to the top 10 lists.
You can query the pre-loaded CSV files using SQL directly. Hereβs a sample query:
import pandas as pd
global_top_10 = pd.read_csv("netflix_top10.csv", index_col=0)
global_top_10.head()
countries_top_10 = pd.read_csv("netflix_top10_country.csv", index_col=0)
countries_top_10.head()
Ready to share your work?
Click "Share" in the upper right corner, copy the link, and share it! You can also add this workspace to your DataCamp Portfolio
Combine the different categories of top 10 lists in a single weekly top 10 list spanning all categories.
# Load the netflix_top10.csv dataset
netflix_top10 = pd.read_csv('netflix_top10.csv')
# Display the first few rows of both datasets for a quick look
netflix_top10_head = netflix_top10.head()
netflix_top10_country_head = netflix_top10_country.head()
netflix_top10_head, netflix_top10_country_head
# Grouping by week and summing the weekly views to get a combined top 10 for each week
combined_weekly_top10 = netflix_top10.groupby(['week', 'show_title']).agg({
'weekly_views': 'sum'
}).reset_index()
# Sorting the data by week and weekly views to get top 10 for each week
combined_weekly_top10 = combined_weekly_top10.sort_values(by=['week', 'weekly_views'], ascending=[True, False])
# Getting the top 10 shows for each week
combined_weekly_top10 = combined_weekly_top10.groupby('week').head(10)
combined_weekly_top10.head(10)
Are there consistent trends or patterns in the content format (tv, film) that make it to the top 10 over different weeks or months?
Extract the month and year from the week column for easier analysis.
Analyze the number of TV shows vs. Films that made it to the top 10 each month.
# Extracting month and year from the 'week' column
netflix_top10['year'] = pd.to_datetime(netflix_top10['week']).dt.year
netflix_top10['month'] = pd.to_datetime(netflix_top10['week']).dt.month
# Grouping by year, month, and category to count the occurrences of each content format in the top 10
content_format_trends = netflix_top10.groupby(['year', 'month', 'category']).size().unstack().reset_index()
content_format_trends.head()
From the data, we observe that each month consistently has a balanced representation from all four categories: "Films (English)", "Films (Non-English)", "TV (English)", and "TV (Non-English)". This is evident from the equal counts across the categories for each month.
To visualize this trend, we can plot a stacked bar chart to show the distribution of content formats in the top 10 lists over the months.
β
β