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")

What was the most frequent movie duration in the 1990s?

To solve this, here is what we should do.

  1. First, we need to find movies released in the 1990s:

    • We create a filter that checks if the release year is between 1990 and 1999.
    • This is done using the np.logical_and function to combine two conditions: one for the year being greater than or equal to 1990, and another for the year being less than or equal to 1999.
  2. Next, we filter for movies:

    • We create another filter that checks if the type is 'Movie'.
  3. Then, we combine these two filters:

    • We use np.logical_and again to combine the filters for the 1990s and for movies.
    • This gives us a subset of the DataFrame that includes only movies released in the 1990s.
  4. Now, we find the most common duration of these movies:

    • We select the 'duration' column from this filtered DataFrame.
    • We use the .mode() function to find the most frequent value in this column.
    • We convert this value to an integer.
  5. Finally, we print the result:

    • We print a message that includes the most frequent movie duration in the 1990s.
import pandas as pd
import numpy as np

netflix_df = pd.read_csv("netflix_data.csv")
netflix_df

between_years = np.logical_and(1990 <= netflix_df['release_year'], netflix_df['release_year'] <= 1999)

movies = netflix_df['type'] == 'Movie'

duration = int(netflix_df[np.logical_and(between_years, movies)]['duration'].mode().values)

print('The most frequent movie duration in the 1990s was ' + str(duration) + ' minutes.')
import pandas as pd

netflix_df = pd.read_csv("netflix_data.csv")
netflix_df

Count the number of short action movies released in the 1990s

To complete this request we will follow these steps.

  1. First, we need to find movies released in the 1990s:

    • We create a filter called between_years that checks if the release year is between 1990 and 1999.
    • This is done using the np.logical_and function to combine two conditions: one for the year being greater than or equal to 1990, and another for the year being less than or equal to 1999.
  2. Next, we filter for movies that are shorter than 90 minutes:

    • We create another filter called length that checks if the duration is less than 90 minutes.
    • We combine this with the between_years filter using np.logical_and.
  3. Then, we filter for movies:

    • We create a filter called type_movie that checks if the type is 'Movie'.
    • We combine this with the length filter using np.logical_and.
  4. Now, we count the short action movies:

    • We create a filter that checks if the genre is 'Action'.
    • We apply this filter to the type_movie filter using np.logical_and.
    • We then count the number of titles that match this combined filter.
  5. Finally, we print the result:

    • We print a message that includes the count of short action movies released in the 1990s.
import pandas as pd
import numpy as np

netflix_df = pd.read_csv("netflix_data.csv")
netflix_df

between_years = np.logical_and(1990 <= netflix_df['release_year'], netflix_df['release_year'] <= 1999)

length = np.logical_and(between_years, netflix_df['duration'] < 90)

type_movie = np.logical_and(length, netflix_df['type'] == 'Movie')

short_movie_count = netflix_df[np.logical_and(type_movie, netflix_df['genre'] == 'Action')]['title'].count()

print('There were ' + str(short_movie_count) + ' short action movies released in the 1990s.')