0% found this document useful (0 votes)
1 views4 pages

assignment4

The document outlines a Jupyter notebook that analyzes Netflix titles using Python, focusing on children's movies, stand-up comedies, and the most watched and highest rated shows. It includes data visualizations using Matplotlib and Seaborn to present the findings. The analysis is based on a CSV file containing Netflix data, with various plots created to showcase the top titles in different categories.

Uploaded by

vaibhavi.darda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views4 pages

assignment4

The document outlines a Jupyter notebook that analyzes Netflix titles using Python, focusing on children's movies, stand-up comedies, and the most watched and highest rated shows. It includes data visualizations using Matplotlib and Seaborn to present the findings. The analysis is based on a CSV file containing Netflix data, with various plots created to showcase the top titles in different categories.

Uploaded by

vaibhavi.darda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

4/14/25, 12:02 PM Untitled1.

ipynb - Colab

from google.colab import files


uploaded = files.upload()

Choose Files No file chosen Upload widget is only available when the cell has been executed in the current browser session. Please rerun this cell to
enable.
Saving netflix titles.csv to netflix titles.csv

import pandas as pd
netflix_data = pd.read_csv('netflix_titles.csv')

children_movies = netflix_data[netflix_data['rating'] == 'PG']

most_watched_shows = netflix_data.sort_values(by='rating', ascending=False).head(10)

highest_rated_show = netflix_data.sort_values(by='rating', ascending=False).head(1)

import matplotlib.pyplot as plt


import seaborn as sns

children_movies_count = children_movies['title'].value_counts().head(20)

plt.figure(figsize=(10, 6))
children_movies_count.plot(kind='bar')

plt.title('Movies Watched by Children')


plt.xlabel('Movie Title')
plt.ylabel('Count')
plt.xticks(rotation=45, ha='right')
plt.tight_layout()
plt.show()

https://colab.research.google.com/drive/1pyWrRheijiWMQ9tzWlgAXg6NI1wHhFHD#scrollTo=QONtHMm-0qtM&printMode=true 1/4
4/14/25, 12:02 PM Untitled1.ipynb - Colab
# Visualization: Total number of stand-up comedies

standup_comedies = netflix_data[netflix_data['listed_in'].str.contains('Stand-Up')]
standup_comedies_count = standup_comedies['title'].value_counts().head(20)
plt.figure(figsize=(10, 6))

standup_comedies_count.plot(kind='bar')

sns.countplot(data=standup_comedies, x='listed_in')
plt.title('Stand-Up Comedies')
plt.xlabel('Comedy Titles')
plt.ylabel('Count')
plt.show()

# Visualization: Most watched shows


most_watched = netflix_data['title'].value_counts().head(20)

plt.figure(figsize=(12, 6))
most_watched.plot(kind='bar', color='orange')

plt.title('Top 20 Most Watched Shows')


plt.xlabel('Show Title')
plt.ylabel('Watch Count')
plt.xticks(rotation=45, ha='right')
plt.tight_layout()
plt.show()

https://colab.research.google.com/drive/1pyWrRheijiWMQ9tzWlgAXg6NI1wHhFHD#scrollTo=QONtHMm-0qtM&printMode=true 2/4
4/14/25, 12:02 PM Untitled1.ipynb - Colab

# Count most common high-rated shows


high_rating = netflix_data[netflix_data['rating'].isin(['TV-MA', 'R'])]
high_rated_shows = high_rating['title'].value_counts().head(20)

plt.figure(figsize=(12, 6))
high_rated_shows.plot(kind='bar', color='crimson')

plt.title('Top 20 Highest Rated Shows (TV-MA / R)')


plt.xlabel('Show Title')
plt.ylabel('Count')
plt.xticks(rotation=45, ha='right')
plt.tight_layout()
plt.show()

import pandas as pd
import matplotlib.pyplot as plt
https://colab.research.google.com/drive/1pyWrRheijiWMQ9tzWlgAXg6NI1wHhFHD#scrollTo=QONtHMm-0qtM&printMode=true 3/4
4/14/25, 12:02 PM Untitled1.ipynb - Colab
import seaborn as sns
import warnings
warnings.filterwarnings("ignore")

children_movies_count = children_movies_count.head(5)
standup_comedy_count = standup_comedy_count.head(5)
most_watched = most_watched.head(5)
high_rated_shows = high_rated_shows.head(5)

fig, axs = plt.subplots(2, 2, figsize=(10, 6))

fig.suptitle('Netflix Dashboard', fontsize=20)

bar_width = 0.6
# 1. Children Movies
sns.barplot(x=children_movies_count.values, y=children_movies_count.index, ax=axs[0, 0], palette='Blues_r')
axs[0, 0].set_title("Top 5 PG Rated Movies (Children)", fontsize=14)
axs[0, 0].set_xlabel("Count")
axs[0, 0].set_ylabel("Movie Title")

# 2. Stand-Up Comedy
sns.barplot(x=standup_comedy_count.values, y=standup_comedy_count.index, ax=axs[0, 1], palette='Oranges_r')
axs[0, 1].set_title("Top 5 Stand-Up Comedy Shows", fontsize=14)
axs[0, 1].set_xlabel("Count")
axs[0, 1].set_ylabel("Show Title")

# 3. Most Watched Shows


sns.barplot(x=most_watched.values, y=most_watched.index, ax=axs[1, 0], palette='Greens_r')
axs[1, 0].set_title("Top 5 Most Watched Shows", fontsize=14)
axs[1, 0].set_xlabel("Views")
axs[1, 0].set_ylabel("Show Title")

# 4. Highest Rated Shows


sns.barplot(x=high_rated_shows.values, y=high_rated_shows.index, ax=axs[1, 1], palette='Reds_r')
axs[1, 1].set_title("Top 5 Highest Rated Shows", fontsize=14)
axs[1, 1].set_xlabel("Rating")
axs[1, 1].set_ylabel("Show Title")

plt.subplots_adjust(top=0.92, bottom=0.08, hspace=0.4, wspace=0.3)

plt.tight_layout(rect=[0, 0.03, 1, 0.95])

https://colab.research.google.com/drive/1pyWrRheijiWMQ9tzWlgAXg6NI1wHhFHD#scrollTo=QONtHMm-0qtM&printMode=true 4/4

You might also like