<jupyter_start><jupyter_text>Dataset Source Dataset used here for the analysis and its license agreement information can be found  can be found by clicking dataset link - DATASETLINK = [dataset_link](https://www.kaggle.com/libinmathew264/youtube-top-4000-channels-based-on-subscribers)<jupyter_code>df = pd.read_csv('YouTube.csv', encoding='ISO-8859-1')
df.head()<jupyter_output><empty_output><jupyter_text>Part I : The most sought-after contents by the YouTube audience<jupyter_code># which type of channels mostly exist on youtube
popular_channels = df.channeltype.value_counts().to_frame('count')
display(popular_channels)
most_popular_channels.plot(kind = 'bar')<jupyter_output><empty_output><jupyter_text>PART II: Curating content for segment-specific audience<jupyter_code># which type of channels has most subscribers
most_subscribed_channels = df.groupby('channeltype').sum()['subscribers'].sort_values(ascending = False).to_frame('subscribers_count')
#most_subscribed_channels.reset_index(level=0, inplace=True)
most_subscribed_channels
#most_subscribed_channels.plot(kind = 'bar')
most_subscribed_channels.plot(kind = 'bar')
# which country has most subscribers for education channel type
education_subscriber = df[df.channeltype == 'Education'].groupby('country').sum()['subscribers'].sort_values(ascending = False).to_frame('Educational_Subscriber')
education_subscriber
# NOTE INDIA is the second largest educational subscriber
education_subscriber.plot(kind = 'bar', figsize=(10, 5), title="Top Educational Subscribers")
# which country has most subscribers for Music channel type
music_subscriber = df[df.channeltype == 'Music'].groupby('country').sum()['subscribers'].sort_values(ascending = False).to_frame('Music_Subscriber')
music_subscriber
# Top 10 music subscriber based countries
music_subscriber[:10].plot(kind = 'bar', rot=0, figsize=(15, 4), title="Music Subscribers")
# which country has most subscribers for Sports channel type
sports_subscriber = df[df.channeltype == 'Sports'].groupby('country').sum()['subscribers'].sort_values(ascending = False).to_frame('Sports_Subscriber')
sports_subscriber
sports_subscriber.plot(kind = 'bar', figsize=(15, 4), title="Sports Subscriber")
# merging all segments into a dataframe
channel_subscribers = None 
for chl_type in df.channeltype.dropna().unique():
    print(chl_type)
    df_ = df[df.channeltype == chl_type].groupby('country').sum()['subscribers'].to_frame(chl_type)
    print(df_.shape)
    if channel_subscribers is None:
        channel_subscribers = df_
    else:
        channel_subscribers = channel_subscribers.join(df_)
df_channel_subscribers = df_channel_subscribers.fillna(0)
df_channel_subscribers
df_channel_subscribers.shape
# Correlation of channeltype subscribers count
sns.heatmap(df_channel_subscribers.corr())<jupyter_output><empty_output><jupyter_text>PART III: Monetising your content<jupyter_code>highest_earning = df.sort_values('MonthlyEarningsMin', ascending=False)
highest_earning = highest_earning[['name', 'MonthlyEarningsMin']]
highest_earning = highest_earning.set_index('name')
highest_earning.head(15).plot(kind = 'bar', figsize=(10, 5), title="Highest Earning")
highest_earning.head(25)<jupyter_output><empty_output>