
3.10
ピボットテーブル
171
合(
Combine
)の両方が
2
次元のグリッド全体で行われます。
3.10.1
ピボットテーブルの必要性
この節では、
Seaborn
ライブラリ(「4.16 Seaborn による可視化」を参照してください)から入手
できるタイタニック号の乗客データベースを使用します。
In[1]: import numpy as np
import pandas as pd
import seaborn as sns
titanic = sns.load_dataset('titanic')
In[2]: titanic.head()
Out[2]:
survived pclass sex age sibsp parch fare embarked class \\
0 0 3 male 2
2.0 1 0 7.2500 S Third
1 1 1 female 38.0 1 0 71.2833 C First
2 1 3 female 26.0 0 0 7.9250 S Third
3 1 1 female 35.0 1 0 53.1000 S First
4 0 3 male 35.0 0 0 8.0500 S Third
who adult_male deck embark_town alive alone
0
man True NaN Southampton no False
1 woman False C Cherbourg yes False
2 woman False ...