text_plain_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

data.shape

Color_Count = data.color.value_counts()
idx = range(2)
labels = ['Color', 'Black & White']
plt.xticks(idx, labels)

Director = data.director_name.value_counts()
D_Name = Director.head(n=10).index
New_D = data[(data['director_name'].isin(D_Name))]
New_D.pivot_table(index=['director_name','imdb_score'],aggfunc='mean')

plt.figure(1,figsize=(12,6))
plt.subplot(1,2,1)
Director.head(n=10).sort_index().plot(kind='bar')
plt.title('Top 10 directors that have most volume movies')

plt.subplot(1,2,2)
New_D.groupby(['director_name'])['imdb_score'].mean().plot(kind='bar')
plt.xlabel("")
plt.title("Top 10 direcotors' average IMDB scores")

plt.show()

Language = data.language.value_counts()

Country = data.country.value_counts()

score_by_content = data.pivot_table(index=['content_rating'], values='imdb_score', aggfunc='mean')
Contents = data.content_rating.value_counts().sort_index()

Year = data.title_year.value_counts().sort_index().tail(50)
year = range(50)
loc = range(3, 49, 5)
ticks = range(1970, 2017, 5)
plt.xticks(loc, ticks)

Gen = data['genres'].str.split('|')
New_Gen = []
Gen_Dict = {}
for item in Gen:
    for i in item:
        New_Gen.append(i)
        if i not in Gen_Dict:
            Gen_Dict[i] = 1
        else:
            Gen_Dict[i] += 1
Gen = pd.DataFrame.from_dict(Gen_Dict, orient='index')
Gen.columns = ['Counts']
Gen = Gen.sort_values('Counts', ascending=1)
Gen.plot(kind='barh', legend=False, figsize=(12, 6))
plt.title('Movie amounts by different genres')
plt.show()