Freedom Sale
Independence Day Special — Unlock the AI Path 70% off our most popular AI course · Limited time offer
--Days
--Hrs
--Min
--Sec
Claim Your Discount
✦ Beginner ⏱ 40 min

🎬 Analyse Netflix Data with Python and Pandas

🎯 What You'll Build

A data analysis notebook that explores the Netflix titles dataset — genre breakdowns, release trends, and top countries.

📋 What You'll Need

1

Load and inspect the dataset

Read the CSV and take a first look at the structure.

import pandas as pd

df = pd.read_csv('netflix_titles.csv')
print(df.shape)
print(df.dtypes)
print(df.head(3))
(8807, 12)
type              object
title             object
director          object
...
(8807, 12) rows × 12 columns
2

Clean the data

Handle missing values and parse dates.

# Fill missing values
df['director'].fillna('Unknown', inplace=True)
df['country'].fillna('Unknown', inplace=True)

# Parse date added
df['date_added'] = pd.to_datetime(df['date_added'].str.strip(), errors='coerce')
df['year_added'] = df['date_added'].dt.year

print(df.isnull().sum())
3

Explore and visualise

Find the most common genres and plot content added per year.

import matplotlib.pyplot as plt

# Movies vs TV Shows
print(df['type'].value_counts())

# Top genres
genres = df['listed_in'].str.split(', ').explode()
top_genres = genres.value_counts().head(10)
print(top_genres)

# Content added per year
df.groupby('year_added')['show_id'].count().plot(kind='bar', figsize=(10,4), title='Titles Added Per Year')
plt.tight_layout()
plt.savefig('netflix_trends.png', dpi=150)
print("Chart saved.")
type
Movie      6131
TV Show    2676
...
Documentaries    299
Stand-Up Comedy  273
...
Chart saved.
💡 Tip: Try groupby on the "rating" column to see which content ratings (PG, TV-MA, etc.) dominate by country.

🎉 You Did It!

You have completed your first real data analysis. Upload the notebook to Kaggle or GitHub to show employers you can work with real datasets.

Found something wrong?

Spotted a bug, broken code, or something that doesn't look right? Tell us what's off and we'll fix it.