In [1]:
from google.colab import files
uploaded = files.upload()
Upload widget is only available when the cell has been executed in the current browser session. Please rerun this cell to enable.
Saving vgsales.csv to vgsales (3).csv
In [2]:
import sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
In [3]:
vg = pd.read_csv('vgsales.csv')
In [4]:
print(vg)
        Rank  ... Global_Sales
0          1  ...        82.74
1          2  ...        40.24
2          3  ...        35.82
3          4  ...        33.00
4          5  ...        31.37
...      ...  ...          ...
16593  16596  ...         0.01
16594  16597  ...         0.01
16595  16598  ...         0.01
16596  16599  ...         0.01
16597  16600  ...         0.01

[16598 rows x 11 columns]
In [5]:
vg.shape
Out[5]:
(16598, 11)
In [6]:
vg.head()
Out[6]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
0 1 Wii Sports Wii 2006.0 Sports Nintendo 41.49 29.02 3.77 8.46 82.74
1 2 Super Mario Bros. NES 1985.0 Platform Nintendo 29.08 3.58 6.81 0.77 40.24
2 3 Mario Kart Wii Wii 2008.0 Racing Nintendo 15.85 12.88 3.79 3.31 35.82
3 4 Wii Sports Resort Wii 2009.0 Sports Nintendo 15.75 11.01 3.28 2.96 33.00
4 5 Pokemon Red/Pokemon Blue GB 1996.0 Role-Playing Nintendo 11.27 8.89 10.22 1.00 31.37
In [7]:
for col in vg.columns:
  print(col)
Rank
Name
Platform
Year
Genre
Publisher
NA_Sales
EU_Sales
JP_Sales
Other_Sales
Global_Sales
In [8]:
vg.shape
Out[8]:
(16598, 11)
In [9]:
vgG = vg.sort_values(['Global_Sales'], ascending=False)
In [10]:
vgG.head(10)
Out[10]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
0 1 Wii Sports Wii 2006.0 Sports Nintendo 41.49 29.02 3.77 8.46 82.74
1 2 Super Mario Bros. NES 1985.0 Platform Nintendo 29.08 3.58 6.81 0.77 40.24
2 3 Mario Kart Wii Wii 2008.0 Racing Nintendo 15.85 12.88 3.79 3.31 35.82
3 4 Wii Sports Resort Wii 2009.0 Sports Nintendo 15.75 11.01 3.28 2.96 33.00
4 5 Pokemon Red/Pokemon Blue GB 1996.0 Role-Playing Nintendo 11.27 8.89 10.22 1.00 31.37
5 6 Tetris GB 1989.0 Puzzle Nintendo 23.20 2.26 4.22 0.58 30.26
6 7 New Super Mario Bros. DS 2006.0 Platform Nintendo 11.38 9.23 6.50 2.90 30.01
7 8 Wii Play Wii 2006.0 Misc Nintendo 14.03 9.20 2.93 2.85 29.02
8 9 New Super Mario Bros. Wii Wii 2009.0 Platform Nintendo 14.59 7.06 4.70 2.26 28.62
9 10 Duck Hunt NES 1984.0 Shooter Nintendo 26.93 0.63 0.28 0.47 28.31
In [11]:
vgG_top=vgG.head(7)
In [12]:
vgG_top
Out[12]:
Rank Name Platform Year Genre Publisher NA_Sales EU_Sales JP_Sales Other_Sales Global_Sales
0 1 Wii Sports Wii 2006.0 Sports Nintendo 41.49 29.02 3.77 8.46 82.74
1 2 Super Mario Bros. NES 1985.0 Platform Nintendo 29.08 3.58 6.81 0.77 40.24
2 3 Mario Kart Wii Wii 2008.0 Racing Nintendo 15.85 12.88 3.79 3.31 35.82
3 4 Wii Sports Resort Wii 2009.0 Sports Nintendo 15.75 11.01 3.28 2.96 33.00
4 5 Pokemon Red/Pokemon Blue GB 1996.0 Role-Playing Nintendo 11.27 8.89 10.22 1.00 31.37
5 6 Tetris GB 1989.0 Puzzle Nintendo 23.20 2.26 4.22 0.58 30.26
6 7 New Super Mario Bros. DS 2006.0 Platform Nintendo 11.38 9.23 6.50 2.90 30.01
In [13]:
plt.bar(x=vgG_top['Name'], height=vgG_top['Global_Sales'])
Out[13]:
<BarContainer object of 7 artists>
In [14]:
plt.figure(figsize=(12,8))
plt.bar(x=vgG_top['Name'], height=vgG_top['Global_Sales'])
plt.xticks(rotation =45)
Out[14]:
([0, 1, 2, 3, 4, 5, 6], <a list of 7 Text major ticklabel objects>)
In [15]:
import seaborn as sns
sns.set()
plt.figure(figsize=(12,8))
plt.bar(x=vgG_top['Name'], height=vgG_top['Global_Sales'])
plt.xticks(rotation =45)
Out[15]:
([0, 1, 2, 3, 4, 5, 6], <a list of 7 Text major ticklabel objects>)
In [16]:
plt.figure(figsize=(12,8))
plt.bar(x=vgG_top['Name'], height=vgG_top['Global_Sales'], color='rgbymcw')
plt.xticks(rotation =45)
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:2: MatplotlibDeprecationWarning: Using a string of single character colors as a color sequence is deprecated. Use an explicit list instead.
  
Out[16]:
([0, 1, 2, 3, 4, 5, 6], <a list of 7 Text major ticklabel objects>)
In [17]:
plt.figure(figsize=(12,8))
plt.bar(x=vgG_top['Name'], height=vgG_top['Global_Sales'], color='rgbymcw')
plt.xticks(rotation =45)
plt.title('Top 7 Video Games in Global Sales')
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:2: MatplotlibDeprecationWarning: Using a string of single character colors as a color sequence is deprecated. Use an explicit list instead.
  
Out[17]:
Text(0.5, 1.0, 'Top 7 Video Games in Global Sales')