text_plain_output_2.png text_plain_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

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)

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()