Netflix! What started in 1997 as a DVD rental service has since exploded into one of the largest entertainment and media companies.
Given the large number of movies and series available on the platform, it is a perfect opportunity to flex your exploratory data analysis skills and dive into the entertainment industry.
You work for a production company that specializes in nostalgic styles. You want to do some research on movies released in the 1990's. You'll delve into Netflix data and perform exploratory data analysis to better understand this awesome movie decade!
You have been supplied with the dataset netflix_data.csv, along with the following table detailing the column names and descriptions. Feel free to experiment further after submitting!
The data
netflix_data.csv
| Column | Description |
|---|---|
show_id | The ID of the show |
type | Type of show |
title | Title of the show |
director | Director of the show |
cast | Cast of the show |
country | Country of origin |
date_added | Date added to Netflix |
release_year | Year of Netflix release |
duration | Duration of the show in minutes |
description | Description of the show |
genre | Show genre |
# Importing pandas and matplotlib
import pandas as pd
import matplotlib.pyplot as plt
# Read in the Netflix CSV as a DataFrame
netflix_df = pd.read_csv("netflix_data.csv")# Start coding here! Use as many cells as you like
netflix_df.head(5)netflix_df.columns#filter according to films from the 1990s
netflix_1990s = netflix_df[netflix_df['release_year'].between(1990, 1999)]
netflix_1990s.head(5)#checking the type of shows
print(netflix_1990s['type'].value_counts())#remove the row with type 'TV show' since its not necessary for our analysis.
netflix_1990s = netflix_df[netflix_df['type'] == 'Movie']netflix_1990s = netflix_df[netflix_df['release_year'].between(1990, 1999)]
# most frequet movie duration
duration = int(netflix_1990s['duration'].mode()[0])
print('The most frequent movie duration = ', duration, 'minutes')
import seaborn as sns
#filter netflix based on movies release year 1990s
netxflix_1990s = netflix_df[netflix_df['release_year'].between(1990,1999)]
#plot the histogram for better visualization
sns.histplot(data=netflix_1990s, x='duration',bins=15, kde=True)
plt.title('Distribution of durations for movies releases in the 1990s')
plt.xlabel('Duration(minutes)')
plt.ylabel('Number of Movies')
plt.showAccording to the histogram, most movies released in the 1990s had a duration between 90 and 110 minutes, making this the most common length range. A relatively small number of short films were produced with durations below 80 minutes. As movie length increases beyond 125 minutes, the frequency slowly declines, indicating that very long films were lesser, but when compared to shorter films, they were more longer films than shorter films.
#Analysis on short movies
#filter the rows and retain those that have a duration of less than 90minutes and are of the genre 'Action'
short_movies=netflix_1990s[(netflix_1990s['duration']<90) & (netflix_1990s['genre'] =='Action')]
#return the number of rows and save the result in short_movie_count
short_movie_count = len(short_movies)
print("The number of short action movies is: ", int(short_movie_count))