数据源来自Kaggle,链接如下:
https://www.kaggle.com/gregorut/videogamesales
导入需要的库,因为只单纯的做分析,基本上就以三个库为主。
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
读取文件
data = pd.read_csv(r'vgsales.csv')
data.head()
Rank - Ranking of overall sales(总销量排名)
Name - The games name(游戏名称)
Platform - Platform of the games release (i.e. PC,PS4, etc.)(游戏平台)
Year - Year of the game's release(游戏发行时间)
Genre - Genre of the game(游戏体裁)
Publisher - Publisher of the game(游戏发行商)
NA_Sales - Sales in North America (in millions)(北美销量)
EU_Sales - Sales in Europe (in millions)(欧洲销量)
JP_Sales - Sales in Japan (in millions)(日本销量)
Other_Sales - Sales in the rest of the world (in millions)(世界其他地方销量)
Global_Sales - Total worldwide sales.(全球总销量)
查看数据概况
data.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 16598 entries, 0 to 16597
Data columns (total 11 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Rank 16598 non-null int64
1 Name 16598 non-null object
2 Platform 16598 non-null object
3 Year 16327 non-null float64
4 Genre 16598 non-null object
5 Publisher 16540 non-null object
6 NA_Sales 16598 non-null float64
7 EU_Sales 16598 non-null float64
8 JP_Sales 16598 non-null float64
9 Other_Sales 16598 non-null float64
10 Global_Sales 16598 non-null float64
dtypes: float64(6), int64(1), object(4)
memory usage: 1.4+ MB
缺失值大概在1.6%左右,直接删除缺失字段,对数据整体分布影响不大。
data.dropna(inplace = True)
数据中共有多少种游戏题材:
#游戏题材
data.Genre.unique()
array(['Sports', 'Platform', 'Racing', 'Role-Playing', 'Puzzle', 'Misc',
'Shooter', 'Simulation', 'Action', 'Fighting', 'Adventure',
'Strategy'], dtype=object)
#游戏平台的数量
data.Platform.unique()
数据中共有多少种游戏平台:
array(['Wii', 'NES', 'GB', 'DS', 'X360', 'PS3', 'PS2', 'SNES', 'GBA',
'3DS', 'PS4', 'N64', 'PS', 'XB', 'PC', '2600', 'PSP', 'XOne', 'GC',
'WiiU', 'GEN', 'DC', 'PSV', 'SAT', 'SCD', 'WS', 'NG', 'TG16',
'3DO', 'GG', 'PCFX'], dtype=object)
数据中共有多少游戏发行商:
#游戏发行商的数量
data.Publisher.unique()
array(['Nintendo', 'Microsoft Game Studios', 'Take-Two Interactive',
'Sony Computer Entertainment', 'Activision', 'Ubisoft',
'Bethesda Softworks', 'Electronic Arts', 'Sega', 'SquareSoft',
'Atari', '505 Games', 'Capcom', 'GT Interactive',
'Konami Digital Entertainment'
], dtype=object)
总共有576个发行商,这里就列举一部分。
#总销量排名前五(以sports类为例)
data.pivot_table(index=['Genre','Name'],values = 'Global_Sales',aggfunc='sum').loc['Sports',:].sort_values(by='Global_Sales',ascending=False).head()
#北美销量排名前五(以sports类为例)
data.pivot_table(index=['Genre','Name'],values = ['NA_Sales'],aggfunc='sum').loc['Sports',:].sort_values(by='NA_Sales',ascending=False).head(5)
#欧洲销量前五(以sports类为例)
data.pivot_table(index=['Genre','Name'],values='EU_Sales',aggfunc='sum').loc['Sports',:].sort_values(by='EU_Sales',ascending=False).head()
#日本销量前五(以sports为例)
data.pivot_table(index=['Genre','Name'],values='JP_Sales',aggfunc='sum').loc['Sports',:].sort_values(by='JP_Sales',ascending=False).head()
#其他地区销量(以sports为例)
data.pivot_table(index=['Genre','Name'],values='Other_Sales',aggfunc='sum').loc['Sports',:].sort_values(by='Other_Sales',ascending=False).head()
#输出各游戏类型的前五名(以总销量为依据)
for genre in data.Genre.unique():
print(genre)
print(data.pivot_table(index=['Genre','Name'],values = 'Global_Sales',aggfunc='sum').loc[genre,:].sort_values(by='Global_Sales',ascending=False).head())
print('*'*40)
Sports
Global_Sales
Name
Wii Sports 82.74
Wii Sports Resort 33.00
Wii Fit 22.72
Wii Fit Plus 22.00
FIFA 15 19.02
****************************************
Platform
Global_Sales
Name
Super Mario Bros. 45.31
New Super Mario Bros. 30.01
New Super Mario Bros. Wii 28.62
Super Mario World 26.07
Super Mario Bros. 3 22.48
****************************************
Racing
Global_Sales
Name
Mario Kart Wii 35.82
Mario Kart DS 23.42
Gran Turismo 3: A-Spec 14.98
Need for Speed: Most Wanted 14.08
Mario Kart 7 12.21
****************************************
Role-Playing
Global_Sales
Name
Pokemon Red/Pokemon Blue 31.37
Pokemon Gold/Pokemon Silver 23.10
The Elder Scrolls V: Skyrim 19.28
Pokemon Diamond/Pokemon Pearl 18.36
Pokemon Ruby/Pokemon Sapphire 15.85
****************************************
Puzzle
Global_Sales
Name
Tetris 35.84
Brain Age 2: More Training in Minutes a Day 15.30
Dr. Mario 10.19
Pac-Man 9.03
Professor Layton and the Curious Village 5.26
****************************************
Misc
Global_Sales
Name
Wii Play 29.02
Minecraft 23.73
Kinect Adventures! 21.82
Brain Age: Train Your Brain in Minutes a Day 20.22
Guitar Hero III: Legends of Rock 16.40
****************************************
Shooter
Global_Sales
Name
Call of Duty: Modern Warfare 3 30.83
Call of Duty: Black Ops II 29.72
Call of Duty: Black Ops 29.40
Duck Hunt 28.31
Call of Duty: Ghosts 27.38
****************************************
Simulation
Global_Sales
Name
Nintendogs 24.76
The Sims 3 15.45
Animal Crossing: Wild World 12.27
Animal Crossing: New Leaf 9.09
Cooking Mama 5.72
****************************************
Action
Global_Sales
Name
Grand Theft Auto V 55.92
Grand Theft Auto: San Andreas 23.86
Grand Theft Auto IV 22.47
Grand Theft Auto: Vice City 16.19
FIFA Soccer 13 16.16
****************************************
Fighting
Global_Sales
Name
Super Smash Bros. Brawl 13.04
Super Smash Bros. for Wii U and 3DS 12.47
Mortal Kombat 8.40
WWE SmackDown vs Raw 2008 7.41
Tekken 3 7.16
****************************************
Adventure
Global_Sales
Name
Assassin's Creed 11.30
Super Mario Land 2: 6 Golden Coins 11.18
L.A. Noire 5.95
Zelda II: The Adventure of Link 4.38
Rugrats: Search For Reptar 3.34
****************************************
Strategy
Global_Sales
Name
Pokemon Stadium 5.45
Warzone 2100 5.01
StarCraft II: Wings of Liberty 4.83
Warcraft II: Tides of Darkness 4.21
Pokémon Trading Card Game 3.70
****************************************
从总销量上来看,运动类游戏的销量最高,策略类游戏的销量最低。
for genre in data.Genre.unique():
print(genre)
print(data.pivot_table(index=['Genre','Publisher'],values='Global_Sales',aggfunc='sum').loc[genre,:].sort_values('Global_Sales',ascending=False).head())
print('*'*40)
Sports
Global_Sales
Publisher
Electronic Arts 468.69
Nintendo 218.01
Konami Digital Entertainment 98.15
Take-Two Interactive 76.77
Activision 75.16
****************************************
Platform
Global_Sales
Publisher
Nintendo 426.18
Sony Computer Entertainment 104.06
Sega 60.84
THQ 40.99
Activision 33.40
****************************************
Racing
Global_Sales
Publisher
Nintendo 151.30
Electronic Arts 145.77
Sony Computer Entertainment 110.57
THQ 40.17
Codemasters 34.52
****************************************
Role-Playing
Global_Sales
Publisher
Nintendo 284.57
Square Enix 97.00
Bethesda Softworks 54.16
Namco Bandai Games 53.82
SquareSoft 52.59
****************************************
Puzzle
Global_Sales
Publisher
Nintendo 124.88
Atari 20.77
THQ 9.25
Warner Bros. Interactive Entertainment 6.65
Hudson Soft 6.61
****************************************
Misc
Global_Sales
Publisher
Nintendo 180.67
Ubisoft 97.53
Sony Computer Entertainment 80.80
Activision 76.55
Microsoft Game Studios 46.99
****************************************
Shooter
Global_Sales
Publisher
Activision 295.40
Electronic Arts 158.26
Microsoft Game Studios 95.46
Nintendo 69.69
Ubisoft 67.65
****************************************
Simulation
Global_Sales
Publisher
Electronic Arts 89.53
Nintendo 85.25
Ubisoft 44.48
Konami Digital Entertainment 32.31
505 Games 22.24
****************************************
Action
Global_Sales
Publisher
Take-Two Interactive 211.08
Ubisoft 142.94
Activision 141.82
Nintendo 128.10
Electronic Arts 115.34
****************************************
Fighting
Global_Sales
Publisher
THQ 72.86
Namco Bandai Games 61.22
Nintendo 53.35
Capcom 32.88
Electronic Arts 30.85
****************************************
Adventure
Global_Sales
Publisher
Nintendo 35.71
Ubisoft 22.19
THQ 19.98
Disney Interactive Studios 17.76
Sony Computer Entertainment 13.55
****************************************
Strategy
Global_Sales
Publisher
Nintendo 26.72
Activision 17.70
Electronic Arts 14.08
Namco Bandai Games 11.83
Konami Digital Entertainment 10.99
****************************************
data.pivot_table(index ='Year',values=['NA_Sales','EU_Sales','JP_Sales','Other_Sales'],aggfunc='sum').plot(figsize=(10,6))
plt.grid()
plt.ylabel('/million')
05-10年发行的游戏销售额最高,其中北美地区的销量位居首位。
data.pivot_table(index='Genre',values = ['NA_Sales','EU_Sales','JP_Sales','Other_Sales'],aggfunc='sum').plot.bar(figsize=(20,6))
fig,axes = plt.subplots(nrows=2,ncols=2,figsize=(20,6),sharex=True,sharey=True)
fig.tight_layout()
data.pivot_table(index='Genre',values=['NA_Sales'],aggfunc='sum').plot.bar(ax=axes[0][0])
data.pivot_table(index='Genre',values=['EU_Sales'],aggfunc='sum').plot.bar(ax=axes[0][1])
data.pivot_table(index='Genre',values=['JP_Sales'],aggfunc='sum').plot.bar(ax=axes[1][0])
data.pivot_table(index='Genre',values=['Other_Sales'],aggfunc='sum').plot.bar(ax=axes[1][1])
从游戏题材的角度来看,动作类游戏销量最好;
从不同地区来看,除了角色扮演类游戏在日本销量最好,其余题材游戏在北美的销售额均为最高。
area = ['Global_Sales','NA_Sales','EU_Sales','JP_Sales','Other_Sales']
for area in area:
print(area)
print(data.pivot_table(index='Publisher',values=[area],aggfunc='sum').sort_values(area,ascending=False).head())
print('*'*40)
Global_Sales
Global_Sales
Publisher
Nintendo 1784.43
Electronic Arts 1093.39
Activision 721.41
Sony Computer Entertainment 607.28
Ubisoft 473.54
****************************************
NA_Sales
NA_Sales
Publisher
Nintendo 815.75
Electronic Arts 584.22
Activision 426.01
Sony Computer Entertainment 265.22
Ubisoft 252.81
****************************************
EU_Sales
EU_Sales
Publisher
Nintendo 418.30
Electronic Arts 367.38
Activision 213.72
Sony Computer Entertainment 187.55
Ubisoft 163.03
****************************************
JP_Sales
JP_Sales
Publisher
Nintendo 454.99
Namco Bandai Games 126.84
Konami Digital Entertainment 90.93
Sony Computer Entertainment 74.10
Capcom 67.38
****************************************
Other_Sales
Other_Sales
Publisher
Electronic Arts 127.63
Nintendo 95.19
Sony Computer Entertainment 80.40
Activision 74.79
Take-Two Interactive 55.20
****************************************
data.pivot_table(index='Platform',values='Global_Sales',aggfunc='sum').sort_values('Global_Sales',ascending=False).plot.bar(figsize=(20,6))
#累计频率曲线
data.pivot_table(index='Platform',values='Global_Sales',aggfunc='sum').sort_values('Global_Sales',ascending=False).apply(lambda x:x.cumsum()/x.sum()).plot.bar(figsize=(20,6))
plt.hlines(y=0.8,xmin=-1,xmax=31,color='r')
area = ['NA_Sales','EU_Sales','JP_Sales','Other_Sales']
fig,ax = plt.subplots(nrows=2,ncols=2,figsize=(20,6),sharex=True,sharey=True)
fig.tight_layout()
for i in range(4):
data.pivot_table(index='Platform',values=area[i],aggfunc='sum').sort_values(area[i],ascending=False).plot.bar(ax=ax.ravel()[i])
for plat in data.Platform.unique():
print(plat)
print(data.pivot_table(index=['Platform','Name'],values='Global_Sales',aggfunc='sum').loc[plat,:].sort_values('Global_Sales',ascending=False).head())
print('*'*40)
Wii
Global_Sales
Name
Wii Sports 82.74
Mario Kart Wii 35.82
Wii Sports Resort 33.00
Wii Play 29.02
New Super Mario Bros. Wii 28.62
****************************************
NES
Global_Sales
Name
Super Mario Bros. 40.24
Duck Hunt 28.31
Super Mario Bros. 3 17.28
Super Mario Bros. 2 7.46
The Legend of Zelda 6.51
****************************************
GB
Global_Sales
Name
Pokemon Red/Pokemon Blue 31.37
Tetris 30.26
Pokemon Gold/Pokemon Silver 23.10
Super Mario Land 18.14
Pokémon Yellow: Special Pikachu Edition 14.64
****************************************
DS
Global_Sales
Name
New Super Mario Bros. 30.01
Nintendogs 24.76
Mario Kart DS 23.42
Brain Age: Train Your Brain in Minutes a Day 20.22
Pokemon Diamond/Pokemon Pearl 18.36
****************************************
X360
Global_Sales
Name
Kinect Adventures! 21.82
Grand Theft Auto V 16.38
Call of Duty: Modern Warfare 3 14.76
Call of Duty: Black Ops 14.64
Call of Duty: Black Ops II 13.73
****************************************
PS3
Global_Sales
Name
Grand Theft Auto V 21.40
Call of Duty: Black Ops II 14.03
Call of Duty: Modern Warfare 3 13.46
Call of Duty: Black Ops 12.73
Gran Turismo 5 10.77
****************************************
PS2
Global_Sales
Name
Grand Theft Auto: San Andreas 20.81
Grand Theft Auto: Vice City 16.15
Gran Turismo 3: A-Spec 14.98
Grand Theft Auto III 13.10
Gran Turismo 4 11.66
****************************************
SNES
Global_Sales
Name
Super Mario World 20.61
Super Mario All-Stars 10.55
Donkey Kong Country 9.30
Super Mario Kart 8.76
Street Fighter II: The World Warrior 6.30
****************************************
GBA
Global_Sales
Name
Pokemon Ruby/Pokemon Sapphire 15.85
Pokemon FireRed/Pokemon LeafGreen 10.49
Pokémon Emerald Version 6.41
Super Mario Advance 5.49
Mario Kart: Super Circuit 5.47
****************************************
3DS
Global_Sales
Name
Pokemon X/Pokemon Y 14.35
Mario Kart 7 12.21
Pokemon Omega Ruby/Pokemon Alpha Sapphire 11.33
Super Mario 3D Land 10.79
New Super Mario Bros. 2 9.82
****************************************
PS4
Global_Sales
Name
Call of Duty: Black Ops 3 14.24
Grand Theft Auto V 11.98
FIFA 16 8.49
Star Wars Battlefront (2015) 7.67
Call of Duty: Advanced Warfare 7.60
****************************************
N64
Global_Sales
Name
Super Mario 64 11.89
Mario Kart 64 9.87
GoldenEye 007 8.09
The Legend of Zelda: Ocarina of Time 7.60
Super Smash Bros. 5.55
****************************************
PS
Global_Sales
Name
Gran Turismo 10.95
Final Fantasy VII 9.72
Gran Turismo 2 9.49
Final Fantasy VIII 7.86
Crash Bandicoot 2: Cortex Strikes Back 7.58
****************************************
XB
Global_Sales
Name
Halo 2 8.49
Halo: Combat Evolved 6.43
Tom Clancy's Splinter Cell 3.02
The Elder Scrolls III: Morrowind 2.86
Fable 2.66
****************************************
PC
Global_Sales
Name
The Sims 3 8.11
World of Warcraft 6.28
Diablo III 5.20
Microsoft Flight Simulator 5.12
StarCraft II: Wings of Liberty 4.83
****************************************
2600
Global_Sales
Name
Pac-Man 7.81
Pitfall! 4.50
Asteroids 4.31
Missile Command 2.76
Frogger 2.20
****************************************
PSP
Global_Sales
Name
Grand Theft Auto: Liberty City Stories 7.72
Monster Hunter Freedom Unite 5.50
Grand Theft Auto: Vice City Stories 5.08
Monster Hunter Freedom 3 4.87
Daxter 4.22
****************************************
XOne
Global_Sales
Name
Call of Duty: Black Ops 3 7.30
Call of Duty: Advanced Warfare 5.13
Grand Theft Auto V 5.08
Halo 5: Guardians 4.26
Fallout 4 4.09
****************************************
GC
Global_Sales
Name
Super Smash Bros. Melee 7.07
Mario Kart: Double Dash!! 6.95
Super Mario Sunshine 6.31
The Legend of Zelda: The Wind Waker 4.60
Luigi's Mansion 3.60
****************************************
WiiU
Global_Sales
Name
Mario Kart 8 6.96
New Super Mario Bros. U 5.19
Super Smash Bros. for Wii U and 3DS 5.02
Splatoon 4.57
Nintendo Land 4.44
****************************************
GEN
Global_Sales
Name
Sonic the Hedgehog 2 6.03
Sonic the Hedgehog 4.34
Mortal Kombat 2.67
Streets of Rage 2.60
NBA Jam 2.05
****************************************
DC
Global_Sales
Name
Sonic Adventure 2.42
Crazy Taxi 1.81
NFL 2K 1.20
Shenmue 1.18
Resident Evil - Code: Veronica 1.14
****************************************
PSV
Global_Sales
Name
Minecraft 2.25
Uncharted: Golden Abyss 1.74
Call of Duty Black Ops: Declassified 1.69
LittleBigPlanet PS Vita 1.47
Assassin's Creed III: Liberation 1.47
****************************************
SAT
Global_Sales
Name
Virtua Fighter 2 1.93
Sega Rally Championship 1.16
Virtua Fighter 1.07
Virtua Cop 0.62
Fighters MEGAMiX 0.62
****************************************
SCD
Global_Sales
Name
Sonic CD 1.50
Shining Force CD 0.14
Formula One World Championship: Beyond the Limit 0.07
Record of Lodoss War: Eiyuu Sensou 0.06
Game no Kanzume Vol 1 0.05
****************************************
WS
Global_Sales
Name
Final Fantasy 0.51
Digimon Adventure: Anode Tamer 0.28
Final Fantasy II 0.25
Chocobo no Fushigi Dungeon for WonderSwan 0.18
Super Robot Taisen Compact 2 Dai-1-Bu 0.17
****************************************
NG
Global_Sales
Name
Samurai Shodown II 0.25
The King of Fighters '95 (CD) 0.23
Samurai Spirits (CD) 0.20
The King of Fighters '95 0.20
The King of Fighters '94 (CD) 0.14
****************************************
TG16
Global_Sales
Name
Doukyuusei 0.14
Ginga Fukei Densetsu: Sapphire 0.02
****************************************
3DO
Global_Sales
Name
Policenauts 0.06
Bust-A-Move 0.02
Sotsugyou II: Neo Generation Special 0.02
****************************************
GG
Global_Sales
Name
Sonic the Hedgehog 2 (8-bit) 0.04
****************************************
PCFX
Global_Sales
Name
Blue Breaker: Ken Yorimo Hohoemi o 0.03
****************************************
for plat in data.Platform.unique():
print(plat)
print(data.pivot_table(index=['Platform','Genre'],values='Name',aggfunc='count').loc[plat,:].sort_values('Name',ascending=False).head())
print('*'*40)
Wii
Name
Genre
Misc 272
Sports 256
Action 230
Racing 92
Simulation 84
****************************************
NES
Name
Genre
Platform 28
Puzzle 14
Sports 14
Action 13
Role-Playing 11
****************************************
GB
Name
Genre
Role-Playing 21
Platform 18
Puzzle 15
Sports 9
Misc 8
****************************************
DS
Name
Genre
Misc 389
Action 335
Simulation 280
Adventure 238
Puzzle 236
****************************************
X360
Name
Genre
Action 318
Sports 215
Shooter 197
Misc 122
Racing 102
****************************************
PS3
Name
Genre
Action 373
Sports 210
Shooter 155
Misc 121
Role-Playing 117
****************************************
PS2
Name
Genre
Sports 391
Action 345
Misc 218
Racing 212
Adventure 196
****************************************
SNES
Name
Genre
Role-Playing 50
Sports 49
Platform 26
Fighting 25
Misc 17
****************************************
GBA
Name
Genre
Action 162
Platform 139
Sports 88
Misc 86
Role-Playing 73
****************************************
3DS
Name
Genre
Action 180
Role-Playing 85
Misc 53
Adventure 36
Platform 28
****************************************
PS4
Name
Genre
Action 122
Role-Playing 47
Sports 43
Shooter 34
Adventure 19
****************************************
N64
Name
Genre
Sports 79
Racing 57
Action 37
Platform 30
Fighting 29
****************************************
PS
Name
Genre
Sports 221
Action 154
Racing 144
Fighting 108
Role-Playing 97
****************************************
XB
Name
Genre
Sports 166
Action 152
Shooter 124
Racing 122
Platform 49
****************************************
PC
Name
Genre
Strategy 184
Action 161
Shooter 145
Simulation 112
Role-Playing 103
****************************************
2600
Name
Genre
Action 55
Shooter 22
Sports 10
Platform 9
Puzzle 8
****************************************
PSP
Name
Genre
Action 217
Adventure 213
Role-Playing 191
Sports 130
Misc 104
****************************************
XOne
Name
Genre
Action 68
Sports 36
Shooter 33
Racing 19
Misc 15
****************************************
GC
Name
Genre
Sports 106
Action 98
Platform 73
Racing 60
Shooter 48
****************************************
WiiU
Name
Genre
Action 63
Misc 21
Platform 16
Shooter 10
Sports 8
****************************************
GEN
Name
Genre
Platform 7
Fighting 5
Action 3
Role-Playing 3
Sports 3
****************************************
DC
Name
Genre
Fighting 12
Adventure 11
Sports 10
Racing 6
Role-Playing 4
****************************************
PSV
Name
Genre
Action 141
Adventure 85
Role-Playing 82
Misc 24
Sports 23
****************************************
SAT
Name
Genre
Fighting 31
Adventure 26
Shooter 22
Strategy 18
Role-Playing 17
****************************************
SCD
Name
Genre
Misc 2
Platform 1
Racing 1
Role-Playing 1
Strategy 1
****************************************
WS
Name
Genre
Role-Playing 4
Strategy 2
****************************************
NG
Name
Genre
Fighting 11
Sports 1
****************************************
TG16
Name
Genre
Adventure 1
Shooter 1
****************************************
3DO
Name
Genre
Adventure 1
Puzzle 1
Simulation 1
****************************************
GG
Name
Genre
Platform 1
****************************************
PCFX
Name
Genre
Role-Playing 1
****************************************
for plat in data.Platform.unique():
print(plat)
print(data.pivot_table(index=['Platform','Publisher'],values='Global_Sales',aggfunc='sum').loc[plat,:].sort_values('Global_Sales',ascending=False).head())
print('*'*40)
Wii
Global_Sales
Publisher
Nintendo 390.34
Ubisoft 92.21
Electronic Arts 62.11
Activision 60.06
Sega 40.56
****************************************
NES
Global_Sales
Publisher
Nintendo 183.97
Namco Bandai Games 16.95
Capcom 14.89
Konami Digital Entertainment 10.46
Enix Corporation 9.55
****************************************
GB
Global_Sales
Publisher
Nintendo 229.06
Konami Digital Entertainment 6.48
Enix Corporation 3.28
Namco Bandai Games 3.23
Eidos Interactive 2.35
****************************************
DS
Global_Sales
Publisher
Nintendo 349.10
Ubisoft 59.71
Activision 41.81
Disney Interactive Studios 37.40
THQ 36.61
****************************************
X360
Global_Sales
Publisher
Electronic Arts 177.97
Microsoft Game Studios 165.16
Activision 158.75
Take-Two Interactive 95.90
Ubisoft 80.58
****************************************
PS3
Global_Sales
Publisher
Electronic Arts 167.09
Sony Computer Entertainment 145.76
Activision 126.39
Take-Two Interactive 83.87
Ubisoft 70.82
****************************************
PS2
Global_Sales
Publisher
Electronic Arts 245.96
Sony Computer Entertainment 172.80
Take-Two Interactive 90.61
Activision 85.59
Konami Digital Entertainment 81.86
****************************************
SNES
Global_Sales
Publisher
Nintendo 96.84
Capcom 18.88
SquareSoft 16.47
Namco Bandai Games 10.81
Enix Corporation 9.61
****************************************
GBA
Global_Sales
Publisher
Nintendo 112.00
THQ 47.80
Konami Digital Entertainment 16.81
Activision 15.30
Electronic Arts 14.31
****************************************
3DS
Global_Sales
Publisher
Nintendo 156.45
Namco Bandai Games 11.37
Capcom 10.68
Level 5 8.66
Square Enix 8.44
****************************************
PS4
Global_Sales
Publisher
Electronic Arts 55.32
Activision 40.26
Ubisoft 31.66
Sony Computer Entertainment 30.71
Take-Two Interactive 25.31
****************************************
N64
Global_Sales
Publisher
Nintendo 129.62
Electronic Arts 13.35
Acclaim Entertainment 12.88
THQ 10.71
Midway Games 7.32
****************************************
PS
Global_Sales
Publisher
Sony Computer Entertainment 193.73
Electronic Arts 90.46
Eidos Interactive 34.01
Konami Digital Entertainment 33.12
SquareSoft 32.19
****************************************
XB
Global_Sales
Publisher
Electronic Arts 57.43
Microsoft Game Studios 46.97
Activision 32.48
Ubisoft 23.36
Take-Two Interactive 12.05
****************************************
PC
Global_Sales
Publisher
Electronic Arts 71.24
Activision 45.95
Ubisoft 15.18
Take-Two Interactive 12.17
Sega 11.64
****************************************
2600
Global_Sales
Publisher
Atari 41.30
Activision 18.38
Parker Bros. 4.97
Imagic 4.82
Coleco 3.06
****************************************
PSP
Global_Sales
Publisher
Sony Computer Entertainment 54.09
Electronic Arts 39.02
Take-Two Interactive 21.66
Konami Digital Entertainment 20.01
Namco Bandai Games 18.15
****************************************
XOne
Global_Sales
Publisher
Electronic Arts 29.34
Microsoft Game Studios 25.40
Activision 23.55
Ubisoft 17.91
Take-Two Interactive 13.00
****************************************
GC
Global_Sales
Publisher
Nintendo 79.15
Electronic Arts 27.12
THQ 13.97
Activision 13.35
Sega 9.53
****************************************
WiiU
Global_Sales
Publisher
Nintendo 57.90
Ubisoft 5.78
Warner Bros. Interactive Entertainment 5.13
Activision 4.15
Disney Interactive Studios 2.17
****************************************
GEN
Global_Sales
Publisher
Sega 19.38
Arena Entertainment 4.72
Acclaim Entertainment 2.45
Virgin Interactive 1.41
Capcom 0.22
****************************************
DC
Global_Sales
Publisher
Sega 12.52
Eidos Interactive 1.28
Namco Bandai Games 0.38
Virgin Interactive 0.36
Capcom 0.27
****************************************
PSV
Global_Sales
Publisher
Sony Computer Entertainment 10.19
Namco Bandai Games 6.10
Warner Bros. Interactive Entertainment 5.29
Sony Computer Entertainment Europe 4.28
Nippon Ichi Software 3.95
****************************************
SAT
Global_Sales
Publisher
Sega 18.91
Namco Bandai Games 1.63
Capcom 1.29
Banpresto 1.10
Atlus 0.92
****************************************
SCD
Global_Sales
Publisher
Sega 1.87
****************************************
WS
Global_Sales
Publisher
SquareSoft 0.76
Namco Bandai Games 0.66
****************************************
NG
Global_Sales
Publisher
SNK 1.39
Hudson Soft 0.03
Technos Japan Corporation 0.02
****************************************
TG16
Global_Sales
Publisher
NEC 0.14
Hudson Soft 0.02
****************************************
3DO
Global_Sales
Publisher
Konami Digital Entertainment 0.06
Imageworks 0.02
Micro Cabin 0.02
****************************************
GG
Global_Sales
Publisher
Sega 0.04
****************************************
PCFX
Global_Sales
Publisher
NEC 0.03
****************************************
data.pivot_table(index=['Publisher'],values = ['Global_Sales','NA_Sales','EU_Sales','JP_Sales','Other_Sales'],aggfunc='sum').loc['Nintendo',:].sort_values().plot.bar(figsize=(10,6))
data.pivot_table(index=['Publisher','Genre'],values='Global_Sales',aggfunc='sum').loc['Nintendo',:].sort_values('Global_Sales').plot.bar(figsize=(10,6))
data.pivot_table(index=['Publisher','Platform'],values='Global_Sales',aggfunc='sum').loc['Nintendo',:].sort_values('Global_Sales').plot.bar(figsize=(10,6))