<jupyter_start><jupyter_text>Import Packages<jupyter_code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"<jupyter_output><empty_output><jupyter_text>Load Data<jupyter_code>movies = pd.read_csv('data/MoviesOnStreamingPlatforms_updated.csv', index_col=0)
tv = pd.read_csv('data/tv_shows.csv', index_col=0)<jupyter_output><empty_output><jupyter_text>Colour Scheme per Streaming Platform<jupyter_code>n_col = '#ff6961'  #'#e50914' # red
h_col = '#77DD77'  #'#1ce783' # green
d_col = '#26abff'  #'#113CCF' # blue
p_col = '#FFB347'  #'#FF9900' # orange<jupyter_output><empty_output><jupyter_text>Check Data of MOVIES<jupyter_code>movies.head()
movies.describe()
movies.isnull().sum()<jupyter_output><empty_output><jupyter_text>Data Cleaning - NaN<jupyter_code>movies.Age = movies.Age.fillna('Unknown')
movies.IMDb = movies.IMDb.fillna(0)
movies['Rotten Tomatoes'] = movies['Rotten Tomatoes'].str.rstrip('%').astype('float') # get rid of the % symbol
movies['Rotten Tomatoes'] = movies['Rotten Tomatoes'].fillna(0)<jupyter_output><empty_output><jupyter_text>Runtime 1256 min?<jupyter_code>#movies[movies.Runtime > 300]
movies.loc[movies.Title == 'Law of the Lawless', ['Runtime']] = 87 # obtained from imdb look up for these >300 min movies
movies.loc[movies.Title == 'Scarlett', ['Runtime']] = 92
movies.loc[movies.Title == 'Carlos el terrorista', ['Runtime']] = 97
movies.loc[movies.Title == 'Colorado', ['Runtime']] = 57
movies.loc[movies.Title == 'The Inner Circle', ['Runtime']] = 96
# Custer's Last Stand actually is 328 min
# The Vatican Museums actually is 410 min<jupyter_output><empty_output><jupyter_text>Check Data of TV<jupyter_code>tv.head()
tv.describe()
tv.isnull().sum()<jupyter_output><empty_output><jupyter_text>Data Cleaning - NaN<jupyter_code>tv.Age = tv.Age.fillna('Unknown')
tv.IMDb = tv.IMDb.fillna(0)
tv['Rotten Tomatoes'] = tv['Rotten Tomatoes'].str.rstrip('%').astype('float') # get rid of the % symbol
tv['Rotten Tomatoes'] = tv['Rotten Tomatoes'].fillna(0)<jupyter_output><empty_output><jupyter_text>Streaming Platform Breakdown<jupyter_code>#Creating different dataframes for each platform FOR EACH SERVICE TYPE (movies or tv)
Hulu_movies = movies.loc[(movies['Hulu'] > 0) ]
Disney_movies = movies.loc[(movies['Disney+'] > 0) ]
Prime_movies = movies.loc[(movies['Prime Video'] > 0)  ]
Netflix_movies = movies.loc[(movies['Netflix'] > 0)  ]
Hulu_tv = tv.loc[(tv['Hulu'] > 0) ]
Disney_tv = tv.loc[(tv['Disney+'] > 0) ]
Prime_tv = tv.loc[(tv['Prime Video'] > 0)  ]
Netflix_tv = tv.loc[(tv['Netflix'] > 0)  ]<jupyter_output><empty_output><jupyter_text>Who has the biggest catalog?<jupyter_code>def donut(i,df,sizes,title):
    plt.subplot(i)
    plt.pie(sizes, explode=explode, labels=labels, colors=colors,
                autopct='%1.1f%%', shadow=True, startangle=0)

    #centre_circle = plt.Circle((0,0),0.5,color='black', fc='white',linewidth=1.25)
    fig = plt.gcf()
    #fig.gca().add_artist(centre_circle)
    plt.title(title, fontsize=20)
    plt.rcParams['font.size'] = 15
    plt.axis('equal')
def val_sum(df,c):
    return df[c].sum(axis=0)

val_counts = []
dfs = [movies,tv]
cols = ['Netflix','Hulu','Prime Video','Disney+']

for x in dfs:
    for y in cols:
        val_counts.append(val_sum(x,y))

fig = plt.subplots(figsize=(16, 8))
labels = 'Netflix', 'Hulu','Prime Video','Disney+'
sizes1 = [val_counts[0], val_counts[1],val_counts[2],val_counts[3]]
sizes2 = [val_counts[4], val_counts[5],val_counts[6],val_counts[7]]
colors = [n_col, h_col, p_col, d_col]
explode = (0, 0, 0, 0) 

donut(121,movies,sizes1,'Movies')
donut(122,tv,sizes2,'TV Shows')
plt.show()
#plt.savefig('../images/Count_per_platform_pie.png')<jupyter_output><empty_output><jupyter_text>Can we evaluate the 'unique' movies/tv shows to each platform?<jupyter_code>tv.groupby(['Netflix','Hulu','Prime Video','Disney+']).count()<jupyter_output><empty_output><jupyter_text>Release year breakdown of movies and TV shows in each catalog?<jupyter_code>def kde(i,dataframe,platform,c):
    plt.subplot(i)
    dataframe=dataframe.loc[dataframe[platform] == 1]
    sns.kdeplot(data=dataframe['Runtime'], color=colors[c],shade=True)
    plt.xlabel('Movie Runtime (minutes)', fontsize = 15)
    plt.xlim(0,200)
    plt.ylim(0,.03)
    plt.subplot(i+1)
    sns.kdeplot(data=dataframe['Year'], color=colors[c],shade=True)
    plt.xlabel('Movie Release Year', fontsize = 15)
    plt.xlim(1900,2040)
    plt.ylim(0,0.12)
    plt.rcParams['font.size'] = 12
    plt.legend([platform], fontsize = 15, bbox_to_anchor=(1.02,.9), loc="upper left");
plt.figure(figsize = (16, 8));

kde(421,movies,'Netflix',0);
kde(423,movies,'Hulu',1);
kde(425,movies,'Prime Video',2);
kde(427,movies,'Disney+',3);
def kdetv(i,dataframe,platform,c):
    plt.subplot(i)
    dataframe=dataframe.loc[dataframe[platform] == 1]
    sns.kdeplot(data=dataframe['Year'], color=colors[c],shade=True)
    plt.xlabel('TV Series Release Year', fontsize = 15)
    plt.xlim(1960,2030)
    plt.ylim(0,0.12)
    plt.legend([platform], fontsize = 15, bbox_to_anchor=(1.02,.9), loc="upper left");
plt.figure(figsize = (8, 8));

kdetv(411,tv,'Netflix',0);
kdetv(412,tv,'Hulu',1);
kdetv(413,tv,'Prime Video',2);
kdetv(414,tv,'Disney+',3);<jupyter_output><empty_output><jupyter_text>What are the popular genres in each catalog?<jupyter_code>#creating helper function that receives a column and returns a new dataframe 
#containing bolean values for each possible option 

def split_multicolumn(genres):
    result_df = genres.to_frame()
    options = []
    # Iterate over the column
    for idx, value  in genres[genres.notnull()].iteritems():
        # Break each value into list of options
        for option in value.split(','):
            # Add the option as a column to result
            if not option in result_df.columns:
                options.append(option)
                result_df[option] = False
            # Mark the value in the option column as True
            result_df.at[idx, option] = True
    return result_df[options]
#performing a sum operation of all True values
movie_genres = mGenres.sum().sort_values(ascending=False)

#plotting into a bar plot
plt.figure(figsize=(12,8))
sns.barplot(x=movie_genres.values, y=movie_genres.index);
genre_col = movie_genres.index.tolist()
mGenres = split_multicolumn(movies.Genres)
Hulu_mG = Hulu_movies.join(mGenres)
Netflix_mG = Netflix_movies.join(mGenres)
Prime_mG = Prime_movies.join(mGenres)
Disney_mG = Disney_movies.join(mGenres)
Hulu_mG.sum()
Hulu_mG = Hulu_mG[genre_col]
Netflix_mG = Netflix_mG[genre_col]
Prime_mG = Prime_mG[genre_col]
Disney_mG = Disney_mG[genre_col]

#since each dataframe above contains only boolean values, now we can use sum() to find
#the quantities for each platform and save it into a new variable we will use in our barplot:
hulu_genres_list = Hulu_mG.sum().sort_values(ascending=False).head(10)/sum(Hulu_mG.sum())*100
netflix_genres_list = Netflix_mG.sum().sort_values(ascending=False).head(10)/sum(Netflix_mG.sum())*100
primevideo_genres_list = Prime_mG.sum().sort_values(ascending=False).head(10)/sum(Prime_mG.sum())*100
disney_genres_list = Disney_mG.sum().sort_values(ascending=False).head(10)/sum(Disney_mG.sum())*100
#creating subplots to show each data into a different ax
fix, axes = plt.subplots(2,2, figsize=(12,8));

#setting titles
axes[0,0].set_title('Hulu');
axes[0,0].set_xlim(0,22.5);
axes[0,1].set_title('Netflix');
axes[0,1].set_xlim(0,22.5);
axes[1,0].set_title('Prime Video');
axes[1,0].set_xlim(0,22.5);
axes[1,0].set_xlabel('Percentage of Catalog (%)');
axes[1,1].set_title('Disney+');
axes[1,1].set_xlim(0,22.5);
axes[1,1].set_xlabel('Percentage of Catalog (%)');
fix.suptitle('Movie Genres', fontsize=16)
#plotting the four barplots using seaborn
sns.barplot(y=hulu_genres_list.index, x=hulu_genres_list.values, ax=axes[0,0],palette='summer');
axes[0,0].axvline(20, color='grey', linestyle='--')
sns.barplot(y=netflix_genres_list.index, x=netflix_genres_list.values, ax=axes[0,1], palette='Reds_r');
axes[0,1].axvline(20, color='grey', linestyle='--')
sns.barplot(y=primevideo_genres_list.index, x=primevideo_genres_list.values, ax=axes[1,0], palette='Wistia_r');
axes[1,0].axvline(20, color='grey', linestyle='--')
sns.barplot(y=disney_genres_list.index, x=disney_genres_list.values, ax=axes[1,1], palette='winter');
plt.tight_layout();
axes[1,1].axvline(20, color='grey', linestyle='--')
plt.show();<jupyter_output><empty_output><jupyter_text>IMDb and Rotten Tomatoes Scoring per platform?<jupyter_code>Hulu_mIMDb = Hulu_movies.loc[Hulu_movies['IMDb']>0]
Netflix_mIMDb = Netflix_movies.loc[Netflix_movies['IMDb']>0]
Prime_mIMDb = Prime_movies.loc[Prime_movies['IMDb']>0]
Disney_mIMDb = Disney_movies.loc[Disney_movies['IMDb']>0]

Hulu_mRotten = Hulu_movies.loc[Hulu_movies['Rotten Tomatoes']>0]
Netflix_mRotten = Netflix_movies.loc[Netflix_movies['Rotten Tomatoes']>0]
Prime_mRotten = Prime_movies.loc[Prime_movies['Rotten Tomatoes']>0]
Disney_mRotten = Disney_movies.loc[Disney_movies['Rotten Tomatoes']>0]

Hulu_tvIMDb = Hulu_tv.loc[Hulu_tv['IMDb']>0]
Netflix_tvIMDb = Netflix_tv.loc[Netflix_tv['IMDb']>0]
Prime_tvIMDb = Prime_tv.loc[Prime_tv['IMDb']>0]
Disney_tvIMDb = Disney_tv.loc[Disney_tv['IMDb']>0]

Hulu_tvRotten = Hulu_tv.loc[Hulu_tv['Rotten Tomatoes']>0]
Netflix_tvRotten = Netflix_tv.loc[Netflix_tv['Rotten Tomatoes']>0]
Prime_tvRotten = Prime_tv.loc[Prime_tv['Rotten Tomatoes']>0]
Disney_tvRotten = Disney_tv.loc[Disney_tv['Rotten Tomatoes']>0]
#Defining plot size and title
fig,ax = plt.subplots(2,2, figsize=(12,10))

ax[0,0].set_title('IMDb Movie Ratings');
ax[0,1].set_title('IMDb TV Ratings');
ax[1,0].set_title('Rotten Tomatoes Movie Ratings');
ax[1,1].set_title('Rotten Tomatoes TV Ratings');

#Plotting the information from each dataset into a KDE plot
sns.histplot(data=Prime_mIMDb['IMDb'], color=p_col, ax=ax[0,0]);
sns.histplot(data=Netflix_mIMDb['IMDb'], color=n_col,  ax=ax[0,0]);
sns.histplot(data=Hulu_mIMDb['IMDb'], color=h_col,  ax=ax[0,0]);
sns.histplot(data=Disney_mIMDb['IMDb'], color=d_col, ax=ax[0,0]);

sns.histplot(data=Prime_mRotten['Rotten Tomatoes'], color=p_col, ax=ax[1,0]);
sns.histplot(data=Netflix_mRotten['Rotten Tomatoes'], color=n_col,  ax=ax[1,0]);
sns.histplot(data=Hulu_mRotten['Rotten Tomatoes'], color=h_col,  ax=ax[1,0]);
sns.histplot(data=Disney_mRotten['Rotten Tomatoes'], color=d_col, ax=ax[1,0]);

sns.histplot(data=Prime_tvIMDb['IMDb'], color=p_col, legend=True, ax=ax[0,1]);
sns.histplot(data=Netflix_tvIMDb['IMDb'], color=n_col,  legend=True, ax=ax[0,1]);
sns.histplot(data=Hulu_tvIMDb['IMDb'], color=h_col,  legend=True, ax=ax[0,1]);
sns.histplot(data=Disney_tvIMDb['IMDb'], color=d_col, legend=True, ax=ax[0,1]);

sns.histplot(data=Prime_tvRotten['Rotten Tomatoes'], color=p_col, ax=ax[1,1]);
sns.histplot(data=Netflix_tvRotten['Rotten Tomatoes'], color=n_col, ax=ax[1,1]);
sns.histplot(data=Hulu_tvRotten['Rotten Tomatoes'], color=h_col, ax=ax[1,1]);
sns.histplot(data=Disney_tvRotten['Rotten Tomatoes'], color=d_col, ax=ax[1,1]);

#Setting the legend
plt.legend(['Prime Video', 'Netflix', 'Hulu', 'Disney+'], bbox_to_anchor=(1,1));
plt.show();
# average for reference of above
print('IMDb - Movies')
print('Prime',round(Prime_mIMDb['IMDb'].mean(),2))
print('Netflix',round(Netflix_mIMDb['IMDb'].mean(),2))
print('Hulu',round(Hulu_mIMDb['IMDb'].mean(),2))
print('Disney+',round(Disney_mIMDb['IMDb'].mean(),2))
print('Rotten Tomatoes - Movies')
print('Prime',round(Prime_mRotten['Rotten Tomatoes'].mean(),2))
print('Netflix',round(Netflix_mRotten['Rotten Tomatoes'].mean(),2))
print('Hulu',round(Hulu_mRotten['Rotten Tomatoes'].mean(),2))
print('Disney',round(Disney_mRotten['Rotten Tomatoes'].mean(),2))
print('IMDb - TV')
print('Prime',round(Prime_tvIMDb['IMDb'].mean(),2))
print('Netflix',round(Netflix_tvIMDb['IMDb'].mean(),2))
print('Hulu',round(Hulu_tvIMDb['IMDb'].mean(),2))
print('Disney',round(Disney_tvIMDb['IMDb'].mean(),2))
print('Rotten Tomatoes - TV')
print('Prime',round(Prime_tvRotten['Rotten Tomatoes'].mean(),2))
print('Netflix',round(Netflix_tvRotten['Rotten Tomatoes'].mean(),2))
print('Hulu',round(Hulu_tvRotten['Rotten Tomatoes'].mean(),2))
print('Disney',round(Disney_tvRotten['Rotten Tomatoes'].mean(),2))<jupyter_output>IMDb - Movies
Prime 5.77
Netflix 6.25
Hulu 6.15
Disney+ 6.44
Rotten Tomatoes - Movies
Prime 64.34
Netflix 66.2
Hulu 66.87
Disney 64.26
IMDb - TV
Prime 7.18
Netflix 7.16
Hulu 7.06
Disney 6.92
Rotten Tomatoes - TV
Prime 76.82
Netflix 77.96
Hulu 78.04
Disney 81.25<jupyter_text>High Rating<jupyter_code>pd.options.display.max_columns = None
movies.groupby('Disney+').describe()
Hulu_mIMDb = Hulu_movies.loc[Hulu_movies['IMDb']>=8]
Netflix_mIMDb = Netflix_movies.loc[Netflix_movies['IMDb']>=8]
Prime_mIMDb = Prime_movies.loc[Prime_movies['IMDb']>=8]
Disney_mIMDb = Disney_movies.loc[Disney_movies['IMDb']>=8]

Hulu_mRotten = Hulu_movies.loc[Hulu_movies['Rotten Tomatoes']>=80]
Netflix_mRotten = Netflix_movies.loc[Netflix_movies['Rotten Tomatoes']>=80]
Prime_mRotten = Prime_movies.loc[Prime_movies['Rotten Tomatoes']>=80]
Disney_mRotten = Disney_movies.loc[Disney_movies['Rotten Tomatoes']>=80]

Hulu_tvIMDb = Hulu_tv.loc[Hulu_tv['IMDb']>=8]
Netflix_tvIMDb = Netflix_tv.loc[Netflix_tv['IMDb']>=8]
Prime_tvIMDb = Prime_tv.loc[Prime_tv['IMDb']>=8]
Disney_tvIMDb = Disney_tv.loc[Disney_tv['IMDb']>=8]

Hulu_tvRotten = Hulu_tv.loc[Hulu_tv['Rotten Tomatoes']>=80]
Netflix_tvRotten = Netflix_tv.loc[Netflix_tv['Rotten Tomatoes']>=80]
Prime_tvRotten = Prime_tv.loc[Prime_tv['Rotten Tomatoes']>=80]
Disney_tvRotten = Disney_tv.loc[Disney_tv['Rotten Tomatoes']>=80]
#Defining plot size and title
fig,ax = plt.subplots(2,2, figsize=(12,10))

ax[0,0].set_title('Best IMDb Movie Ratings');
ax[0,1].set_title('Best IMDb TV Ratings');
ax[1,0].set_title('Best Rotten Tomatoes Movie Ratings');
ax[1,1].set_title('Best Rotten Tomatoes TV Ratings');

#Plotting the information from each dataset into a KDE plot
sns.histplot(data=Prime_mIMDb['IMDb'], color=p_col, ax=ax[0,0]);
sns.histplot(data=Netflix_mIMDb['IMDb'], color=n_col,  ax=ax[0,0]);
sns.histplot(data=Hulu_mIMDb['IMDb'], color=h_col,  ax=ax[0,0]);
sns.histplot(data=Disney_mIMDb['IMDb'], color=d_col, ax=ax[0,0]);

sns.histplot(data=Prime_mRotten['Rotten Tomatoes'], color=p_col, ax=ax[1,0]);
sns.histplot(data=Netflix_mRotten['Rotten Tomatoes'], color=n_col,  ax=ax[1,0]);
sns.histplot(data=Hulu_mRotten['Rotten Tomatoes'], color=h_col,  ax=ax[1,0]);
sns.histplot(data=Disney_mRotten['Rotten Tomatoes'], color=d_col, ax=ax[1,0]);

sns.histplot(data=Prime_tvIMDb['IMDb'], color=p_col, legend=True, ax=ax[0,1]);
sns.histplot(data=Netflix_tvIMDb['IMDb'], color=n_col,  legend=True, ax=ax[0,1]);
sns.histplot(data=Hulu_tvIMDb['IMDb'], color=h_col,  legend=True, ax=ax[0,1]);
sns.histplot(data=Disney_tvIMDb['IMDb'], color=d_col, legend=True, ax=ax[0,1]);

sns.histplot(data=Prime_tvRotten['Rotten Tomatoes'], color=p_col, ax=ax[1,1]);
sns.histplot(data=Netflix_tvRotten['Rotten Tomatoes'], color=n_col, ax=ax[1,1]);
sns.histplot(data=Hulu_tvRotten['Rotten Tomatoes'], color=h_col, ax=ax[1,1]);
sns.histplot(data=Disney_tvRotten['Rotten Tomatoes'], color=d_col, ax=ax[1,1]);

#Setting the legend
plt.legend(['Prime Video', 'Netflix', 'Hulu', 'Disney+'], bbox_to_anchor=(1,1));
plt.show();<jupyter_output><empty_output><jupyter_text>Age of Audience Suggested?<jupyter_code>hulu_mages = Hulu_movies.Age.value_counts().drop('Unknown')
netflix_mages = Netflix_movies.Age.value_counts().drop('Unknown')
primevideo_mages = Prime_movies.Age.value_counts().drop('Unknown')
disney_mages = Disney_movies.Age.value_counts().drop('Unknown')

hulu_tvages = Hulu_tv.Age.value_counts().drop('Unknown')
netflix_tvages = Netflix_tv.Age.value_counts().drop('Unknown')
primevideo_tvages = Prime_tv.Age.value_counts().drop('Unknown')
disney_tvages = Disney_tv.Age.value_counts().drop('Unknown')
hulu_mages
df_list = [hulu_mages,netflix_mages,primevideo_mages,disney_mages,hulu_tvages,netflix_tvages,primevideo_tvages,disney_tvages]
for i in df_list:
    i.loc[i['Age'] == '18+', ['Age']] = 'NC-17'
    i.loc[i['Age'] == '7+', ['Age']] = 'PG'
    i.loc[i['Age'] == '13+', ['Age']] = 'PG-13'
    i.loc[i['Age'] == 'all', ['Age']] = 'G'
    i.loc[i['Age'] == '16+', ['Age']] = 'R'<jupyter_output><empty_output><jupyter_text>* **G – General Audiences** - All ages admitted. * **PG – Parental Guidance Suggested** - Some material may not be suitable for children. (7+)* **PG-13 – Parents Strongly Cautioned** - Some material may be inappropriate for children under 13. (13+)* **R – Restricted** - Under 17 requires accompanying parent or adult guardian. (16+)* **NC-17 – Adults Only** - No One 17 and Under Admitted. (18+)<jupyter_code>x = ['G','PG','PG-13','R','NC-17']

#is this the best code? NO. But it will work in a pinch for this one purpose **only**...
hulu_mov = [55,109,119,17,290]
net_mov = [130,323,383,89,752]
prim_mov = [406,916,819,226,2612]
dis_mov = [277,179,40,1,3]

hulu_tv = [159,365,0,514,239]
net_tv = [171,300,3,398,359]
prim_tv = [192,224,1,209,182]
dis_tv = [81,66,0,3,0]

mov_age = pd.DataFrame([['G',55,130,406,277],['PG',109,323,916,179],['PG-13',119,383,819,40],['R',17,89,226,1],['NC-17',290,752,2612,3]],
                      columns=['Rating','Hulu','Netflix','Prime Video','Disney+'])

tv_age = pd.DataFrame([['G',159,171,192,81],['PG',365,300,224,66],['PG-13',0,3,1,0],['R',514,398,209,3],['NC-17',239,359,182,0]],
                      columns=['Rating','Hulu','Netflix','Prime Video','Disney+'])

colors = [h_col, n_col, p_col, d_col]

fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(10,6));
mov_age.plot(x='Rating', ax=axes[0], kind='bar', title='Movies', color=colors);
tv_age.plot(x='Rating', ax=axes[1], kind='bar', title='TV', color=colors, legend=False);
fig.suptitle('Age Classification *', fontsize=16);
axes[0].set_xlabel('');
axes[1].set_xlabel('');

# annotations
fig.text(0.11, -.12, '* G – General Audiences - All ages admitted.\n  PG – Parental Guidance Suggested - Some material may not be suitable for children. (7+)\n  PG-13 – Parents Strongly Cautioned - Some material may be inappropriate for children under 13. (13+)\n  R – Restricted - Under 17 requires accompanying parent or adult guardian. (16+)\n  NC-17 – Adults Only - No One 17 and Under Admitted. (18+)', ha='left');
x = ['G','PG','PG-13','R','NC-17']

mov_age = pd.DataFrame([['G',55/590*100,130/1677*100,406/4979*100,277/500*100],
                        ['PG',109/590*100,323/1677*100,916/4979*100,179/500*100],
                        ['PG-13',119/590*100,383/1677*100,819/4979*100,40/500*100],
                        ['R',17/590*100,89/1677*100,226/4979*100,1/500*100],
                        ['NC-17',290/590*100,752/1677*100,2612/4979*100,3/500*100]],
                      columns=['Rating','Hulu','Netflix','Prime Video','Disney+'])

tv_age = pd.DataFrame([['G',159/1277*100,171/1231*100,192/808*100,81/150*100],
                       ['PG',365/1277*100,300/1231*100,224/808*100,66/150*100],
                       ['PG-13',0/1277*100,3/1231*100,1/808*100,0/150*100],
                       ['R',514/1277*100,398/1231*100,209/808*100,3/150*100],
                       ['NC-17',239/1277*100,359/1231*100,182/808*100,0/150*100]],
                      columns=['Rating','Hulu','Netflix','Prime Video','Disney+'])

colors = [h_col, n_col, p_col, d_col]

fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(10,6));
mov_age.plot(x='Rating', ax=axes[0], kind='bar', title='Movies', color=colors, legend=False);
tv_age.plot(x='Rating', ax=axes[1], kind='bar', title='TV', color=colors, legend=False);
fig.suptitle('Age Classification *', fontsize=16);
plt.legend(bbox_to_anchor=(1.5, 1))
axes[0].set_xlabel('');
axes[0].set_ylabel('Percentage of Platform Catalog (%)');
axes[0].set_ylim(0,60);
axes[1].set_ylim(0,60);
axes[1].set_xlabel('');

# annotations
fig.text(0.11, -.17, '* G – General Audiences - All ages admitted.\n  PG – Parental Guidance Suggested - Some material may not be suitable for children. (7+)\n  PG-13 – Parents Strongly Cautioned - Some material may be inappropriate for children under 13. (13+)\n  R – Restricted - Under 17 requires accompanying parent or adult guardian. (16+)\n  NC-17 – Adults Only - No One 17 and Under Admitted. (18+)', ha='left');<jupyter_output><empty_output><jupyter_text>Pricing<jupyter_code># Canada 2021 Pricing
netflix = {'basic':9.99,'standard':14.99,'premium':16.99}
hulu = {'With Ads':5.99,'Ad-Free':11.99, 'Live TV':54.99}
prime = {'Monthly':7.99,'Prime/Year':79}
disney = {'Monthly':11.99}<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18480522622792162, 'fraction_numerical': 0.058988628115170576, 'mean_word_length': 6.763335837716003, 'pattern_counts': {'":': 0, '<': 72, '<?xml version=': 0, '>': 114, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '18', 'dir': 'jupyter-structured-clean-dedup', 'id': '113131', 'license': 'MIT', 'n_tokens_mistral': 9123, 'n_tokens_neox': 8289, 'n_words': 1321, 'path': 'Streaming_EDA.ipynb', 'repo_name': 'robynmundle/tv_movies_data_exploration', 'size': '20665'}