seabornによる統計データ可視化(ポケモン種族値を例に)(1)
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
pkmn.head()
#
|
Name
|
Type 1
|
Type 2
|
Total
|
HP
|
Attack
|
Defense
|
Sp. Atk
|
Sp. Def
|
Speed
|
Generation
|
Legendary
|
|
0
|
1
|
Bulbasaur
|
Grass
|
Poison
|
318
|
45
|
49
|
49
|
65
|
65
|
45
|
1
|
False
|
1
|
2
|
Ivysaur
|
Grass
|
Poison
|
405
|
60
|
62
|
63
|
80
|
80
|
60
|
1
|
False
|
2
|
3
|
Venusaur
|
Grass
|
Poison
|
525
|
80
|
82
|
83
|
100
|
100
|
80
|
1
|
False
|
3
|
3
|
VenusaurMega Venusaur
|
Grass
|
Poison
|
625
|
80
|
100
|
123
|
122
|
120
|
80
|
1
|
False
|
4
|
4
|
Charmander
|
Fire
|
NaN
|
309
|
39
|
52
|
43
|
60
|
50
|
65
|
1
|
False
|
pkmn[pkmn["HP"]>200]
#
|
Name
|
Type 1
|
Type 2
|
Total
|
HP
|
Attack
|
Defense
|
Sp. Atk
|
Sp. Def
|
Speed
|
Generation
|
Legendary
|
|
121
|
113
|
Chansey
|
Normal
|
NaN
|
450
|
250
|
5
|
5
|
35
|
105
|
50
|
1
|
False
|
261
|
242
|
Blissey
|
Normal
|
NaN
|
540
|
255
|
10
|
10
|
75
|
135
|
55
|
2
|
False
|
ということでChansey(和名: ラッキー) とBlissey(和名: ハピナス)のようです。実際のデータ分析でも、このようにグラフから外れ値の有無/内容を確認していく作業は重要になります。
swarmplot
plt.figure(figsize=(15, 8))
plt.figure(figsize=(15, 8))
plt.figure(figsize=(15, 8))
plt.figure(figsize=(15, 8))
plt.figure(figsize=(15, 8))
plt.figure(figsize=(15, 8))
plt.figure(figsize=(15, 8))
plt.figure(figsize=(15, 8))