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")
#The most frequent movie duration in the 1990s.
year=netflix_df[(netflix_df['release_year']>=1990) & (netflix_df['release_year']<2000) & (netflix_df['type']=='Movie')]
duration=int(year['duration'].mode())
print('duration=', duration)
plt.hist(year['duration'], bins=25, color='red')
plt.xlabel('Duration (in minutes)--->')
plt.ylabel('Number of Movies--->')
plt.title('Histogram of Movie Durations in 1990s')
plt.show()
#Number of movies per duration
print(year['duration'].value_counts(sort=True))
#Movies List of 1990s
new=netflix_df.loc[(netflix_df['release_year']>=1990) & (netflix_df['release_year']<2000), ['show_id','title', 'release_year', 'duration']]
a=new.sort_values('duration', ascending=False)
print(a)
#Number of Short Movies of 1990s
short_movie_count= len(netflix_df[(netflix_df['duration']<90) & (netflix_df['genre']=='Action') & (netflix_df['type']=='Movie') & (netflix_df['release_year']>=1990) & (netflix_df['release_year']<2000)])
print(short_movie_count)
#Plot of Short Movies of 1990s with their respective durations
short_movies= netflix_df[(netflix_df['duration']<90) & (netflix_df['genre']=='Action') & (netflix_df['type']=='Movie') & (netflix_df['release_year']>=1990) & (netflix_df['release_year']<2000)]
short_movies.plot(kind='bar', x='title', y='duration', color='magenta')
plt.xlabel('Movie Titles--->')
plt.ylabel('Duration in minutes--->')
plt.title('Short Movies of 1990s')
plt.ylim(0, 94)
plt.show()
#Data belongs to years between 1942 and 2021
print(netflix_df['release_year'].max())
print(netflix_df['release_year'].min())
recent=netflix_df[(netflix_df['release_year']>=2020) & (netflix_df['release_year']<=2022) & (netflix_df['type']=='Movie') & (netflix_df['country']=='India')]
movies_2020_21=recent.loc[:,['title', 'release_year', 'genre']]
print(movies_2020_21)
#Number of movies per genre from 2020 onwards
movies_per_genre=movies_2020_21['genre'].value_counts()
print(movies_per_genre)
movies_per_genre.plot(kind='pie', explode=[0.1,0.1,0,0,0,0,0], startangle=60, autopct='%1.0f%%')