#!/usr/bin/env python # coding: utf-8 # ## Import Libraries # In[1]: import pandas as pd import numpy as np import matplotlib.pyplot as plt # ## Get Data # In[2]: df = pd.read_csv('./DataSets/netflix_titles.csv') df.head() # In[11]: n = df.groupby(['release_year', 'type'], as_index=False).show_id.count() n.columns = ['release_year', 'type', 'count'] pivot = n_data.pivot(index='release_year', columns='type', values='count').reset_index() pivot.fillna(0, inplace = True) pivot.head() # ## Creating a Chart # In[14]: # Declare a chart with one Axis fig, ax = plt.subplots() # Creating some dummy data ax.plot(pivot.release_year, pivot.Movie, label = 'Movies') ax.plot(pivot.release_year, pivot['TV Show'], label = 'Tv Shows') ax.set_ylabel('Number of Movies/TV Shows') ax.set_xlabel('Year of Release') ax.set_title("Trend Chart") plt.text(x=1970, y=400, s=r'Majority Movies are released after 2000 and Tv Shows mostly after 2010')#, fontsize = 12) fig.set_size_inches(18.5, 10.5) plt.grid() ax.legend(); # In[ ]: