Skip to content

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

ColumnDescription
show_idThe ID of the show
typeType of show
titleTitle of the show
directorDirector of the show
castCast of the show
countryCountry of origin
date_addedDate added to Netflix
release_yearYear of Netflix release
durationDuration of the show in minutes
descriptionDescription of the show
genreShow genre
# Importing pandas and matplotlib
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

# Read in the Netflix CSV as a DataFrame
netflix_df = pd.read_csv("netflix_data.csv")
netflix_df
# Task 1: What was the most frequent movie duration in the 1990s? Save an approximate answer as an integer called duration (use 1990 as the decade's start year).

# Filter netflix dataframe for movies release in the 1990s (1990-1999)
set1 = netflix_df[ (netflix_df["release_year"] >= 1990) & (netflix_df["release_year"] < 2000) & (netflix_df["type"] == "Movie")]

# Show histogram for visual representation
plt.hist(set1[:]["duration"],bins = 50, range = (90, 100))
plt.show()
# plt.clt()

# Get the most frequent duration by using .mode() aggregate function, this matches what is shown in the histogram which is 94 minutes.
duration = set1["duration"].mode()[0]
# Task 2: Count the number of short action movies (duration of less than 90 minutes) in the 1990s, save as short_movie_count (int)

# Re-use set1 subset since it is a set of movies from 1990s
# Subset/filter for less than 90 minutes duration and action genre
set2 = set1[np.logical_and(set1["genre"] == "Action", set1["duration"] < 90)]

# Calculate for the number of short action 1990s movies using len which is 7.
short_movie_count = len(set2) 

# For visual representation of how many short action 1990s there are
plt.bar(set2["duration"].value_counts().index, set2["duration"].value_counts().values)
plt.xlabel("Duration")
plt.ylabel("Frequency")
plt.show()
# to verify set0 subset
set1
set2