text_plain_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

data = pd.read_csv('../input/video-game-sales-with-ratings/Video_Games_Sales_as_at_22_Dec_2016.csv')

col_remove = ['Critic_Score', 'Critic_Count', 'User_Score', 'User_Count', 'Developer', 'Rating']
data_clear = data.drop(labels=col_remove, axis=1)
data_clear.isnull().sum()

data_clear = data_clear.dropna(axis=0)

data_sales_sort = data_clear.sort_values(by=['Global_Sales'], ascending=False)

#Ten best games
data_sales_sort_hd = data_sales_sort.head(10).sort_values(by=['Global_Sales'], ascending = True)
top10_games_gs = data_sales_sort_hd['Name'].head(10)
top10_sales_gs = data_sales_sort_hd['Global_Sales'].head(10)

fig, ax = plt.subplots()
p1 = ax.barh(top10_games_gs, top10_sales_gs)
ax.set_title('Top 10 global selling video games')
ax.set_xlabel('Sales [million units]')
ax.set_ylabel('Video game names')
ax.bar_label(p1, label_type='center')

plt.show()

sales_regions = ['NA_Sales', 'EU_Sales', 'JP_Sales', 'Other_Sales']
fig, axes = plt.subplots(int(len(sales_regions) / 2), int(len(sales_regions) / 2), figsize=(16, 10))
axes = axes.ravel()
for index, region in enumerate(sales_regions):
    data_sales_sort = data_clear.sort_values(by=region, ascending=True)
    sns.barplot(x=data_sales_sort[region].tail(10), y=data_sales_sort['Name'].tail(10), ax=axes[index])
    axes[index].set_title(f'Top 10 {region} Video games', fontsize=14)
    axes[index].set_xlabel(f'{region} [million units]', fontsize=14)
    axes[index].set_ylabel('Video game Name', fontsize=14)
    axes[index].bar_label(axes[index].containers[0], label_type='center')
plt.suptitle('10 top sellers per region', fontsize=18)
plt.tight_layout()
plt.show()