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

# Read in the Netflix CSV as a DataFrame
netflix_df = pd.read_csv("netflix_data.csv")

Guided question: What was the most frequent movie duration in the 1990s? Save an as an integer called most_frequent.

Spinner
DataFrameas
df
variable
SELECT duration, COUNT(duration) AS most_frequent
FROM netflix_df
WHERE release_year BETWEEN 1990 AND 1999
AND type = 'Movie'
GROUP BY duration
ORDER BY COUNT(duration) DESC
Current Type: Bar
Current X-axis: duration_2
Current Y-axis: duration
Current Color: None

Movie Duration (in minutes) in 1990s

The most frequent duration for movies in the 1990's was 94 minutes.


Guided question: A movie is considered short if it is less than 90 minutes. Count the number of short action movies released in the 1990s and save this integer as short_movie_count.

Spinner
DataFrameas
df2
variable
SELECT title, type, genre, duration
FROM netflix_df
WHERE release_year BETWEEN 1990 AND 1999

First, I preview the data in the columns of title, type, duration and genre so I make sure that I am filtering for just the movies.

Then, I refine the code to select movies that are only Action and less than 90 minutes and add a count feature to get the total number of movies that are less than 90 minutes saved as an integer short_movie_count.

Spinner
DataFrameas
df1
variable
SELECT COUNT(*) AS short_movie_count
FROM netflix_df
WHERE release_year BETWEEN 1990 AND 1999
AND type = 'Movie'
AND genre = 'Action'
AND duration < 90

I end up with a total of 7 Action movies that are less than 90 minutes.

Which movies are these? We can replace count with title in the code to see the titles of these movies.

Spinner
DataFrameas
df3
variable
SELECT title
FROM netflix_df
WHERE release_year BETWEEN 1990 AND 1999
AND type = 'Movie'
AND genre = 'Action'
AND duration < 90

What if I want to see the number of movies in each genre in the database?

I would use a similar code as above but change the COUNT from counting duration to counting genres and group by genre.

Spinner
DataFrameas
df4
variable
SELECT genre, COUNT(genre) AS number_per_genre
FROM netflix_df
WHERE release_year BETWEEN 1990 AND 1999
AND type = 'Movie'
GROUP BY genre
ORDER BY COUNT(genre) DESC
Current Type: Bar
Current X-axis: genre
Current Y-axis: number_per_genre
Current Color: index

Number of Movies in Database per Genre