image_output_1.png
import matplotlib.pyplot as plt

import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

import warnings

import seaborn as sns
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings('ignore')
plt.style.use('fivethirtyeight')

df = pd.read_csv('../input/netflix-shows/netflix_titles.csv')

df.isnull().sum()

df = df.dropna()

df_shows = df[df['type'] == 'TV Show']
df_movies = df[df['type'] == 'Movie']
df_date = df_shows[['date_added']].dropna()
df_date['year'] = df_date['date_added'].apply(lambda x: x.split(', ')[-1])
df_date['month'] = df_date['date_added'].apply(lambda x: x.lstrip().split(' ')[0])
month_order = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'][::-1]
dfu = df_date.groupby('year')['month'].value_counts().unstack().fillna(0)[month_order].T
plt.pcolor(dfu, cmap='afmhot_r', edgecolors='white', linewidths=2)
plt.xticks(np.arange(0.5, len(dfu.columns), 1), dfu.columns, fontsize=7, fontfamily='serif')
plt.yticks(np.arange(0.5, len(dfu.index), 1), dfu.index, fontsize=7, fontfamily='serif')
cbar = plt.colorbar()
cbar.ax.tick_params(labelsize=8)
cbar.ax.minorticks_on()

df['date_added'] = pd.to_datetime(df['date_added'])
df['day_added'] = df['date_added'].dt.day
df['year_added'] = df['date_added'].dt.year
df['month_added'] = df['date_added'].dt.month
df['year_added'].astype(int)
df['day_added'].astype(int)

f, ax = plt.subplots(1, 2, figsize=(18, 8))
df['type'].value_counts().plot.pie(explode=[0, 0.1], autopct='%1.1f%%', ax=ax[0], shadow=True)
ax[0].set_title('Type of Movie')
ax[0].set_ylabel('Count')
sns.countplot('type', data=df, ax=ax[1], order=df['type'].value_counts().index)
ax[1].set_title('Count of Source')
plt.show()