In [1]:
#%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

import seaborn as sns
sns.set(style="darkgrid")

In [2]:
data = pd.read_csv('./input/Video_Games_Sales_as_at_30_Nov_2016.csv')
data.head()


Out[2]:
Name Platform Year_of_Release Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales Critic_Score Critic_Count User_Score User_Count Developer Rating
0 Wii Sports Wii 2006.0 Sports Nintendo 41.36 28.95 3.77 8.45 82.53 76.0 51.0 8 321.0 Nintendo E
1 Mario Kart Wii Wii 2008.0 Racing Nintendo 15.67 12.75 3.79 3.28 35.50 82.0 73.0 8.3 709.0 Nintendo E
2 Wii Sports Resort Wii 2009.0 Sports Nintendo 15.61 10.92 3.28 2.95 32.76 80.0 73.0 8 192.0 Nintendo E
3 New Super Mario Bros. DS 2006.0 Platform Nintendo 11.28 9.14 6.50 2.88 29.79 89.0 65.0 8.5 431.0 Nintendo E
4 Wii Play Wii 2006.0 Misc Nintendo 13.96 9.18 2.93 2.84 28.92 58.0 41.0 6.6 129.0 Nintendo E

In [3]:
fig = plt.figure()

ax1 = fig.add_subplot(411)

idx = 0
hcat1 = sorted(data.Platform.unique())
for cat_val in hcat1:
    ax1.bar(idx,data[data['Platform']==cat_val].Global_Sales.sum(), color=np.random.rand(3,1))
    idx = idx + 1

ax2 = fig.add_subplot(412)
idx = 0
hcat2 = sorted(data.Year_of_Release.unique())
for cat_val in hcat2:    
    ax2.bar(idx,data[data['Year_of_Release']==cat_val].Global_Sales.sum(), color=np.random.rand(3,1))
    idx = idx + 1
    
ax3 = fig.add_subplot(413)
idx = 0
hcat3 = sorted(data.Genre.unique())
for cat_val in hcat3: 
    ax3.bar(idx,data[data['Genre']==cat_val].Global_Sales.sum(), color=np.random.rand(3,1))
    idx = idx + 1
    
ax4 = fig.add_subplot(414)
idx = 0
hcat4 = sorted(data['Rating'].dropna().unique())
for cat_val in hcat4: 
    ax4.bar(idx,data[data['Rating']==cat_val].Global_Sales.sum(), color=np.random.rand(3,1))
    idx = idx + 1
    
ax1.set_title('Global Sales by Platform')
ax2.set_title('Global Sales by Year')
ax3.set_title('Global Sales by Genre')
ax4.set_title('Global Sales by Rating')
ax1.set_xticklabels(hcat1)
ax2.set_xticklabels(hcat2)
ax3.set_xticklabels(hcat3)
ax4.set_xticklabels(hcat4)   
fig.subplots_adjust(hspace=1)



In [4]:
#data['User_Score'].dropna()

In [ ]: