Skip to Content
Pythonデータサイエンスハンドブック ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習
book

Pythonデータサイエンスハンドブック ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習

by Jake VanderPlas, 菊池 彰
May 2018
Intermediate to advanced
556 pages
13h 21m
Japanese
O'Reilly Japan, Inc.
Content preview from Pythonデータサイエンスハンドブック ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習
134
3
章 
pandas
を使ったデータ操作
基本的に
4
次元データであり、次元は被験者(
subject
)、測定タイプ(
type
)、年(
year
)、検査回(
visit
です。これを用いると、例えば、トップレベルの列を被験者の名前でインデクス指定し、その人の
情報だけを含む完全なデータフレームを取得できます。
In[20]: health_data['Guido']
Out[20]: type HR Temp
year visit
2013 1 32.0 36.7
2 50.0 35.0
2014 1 39.0 37.8
2 48.0 37.3
多くの被験者(人、国、都市など)の複数回にわたる複数の測定値を含む複雑なレコードの場合、
行と列を階層化することで扱
いが非常に簡単になります。
3.6.3
MultiIndex
のインデクス指定とスライス
MultiIndex
でのインデクス指定とスライスは直観的に設計されており、インデクスを追加次元
と考えると理解が容易です。まず、多重インデクス付き
Series
のインデクス指定を取り上げ、続
いてインデクス付き
DataFrame
に取り掛かります。
3.6.3.1
 多重インデクス
Series
先に作った多重インデクスを持つ各州の人口データで考えてみましょう。
Out[21]: state year
California 2000 33871648
2010 37253956
New York 2000 18976457
2010 19378102
Te
xas 2000 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Pythonデータサイエンスハンドブック 第2版 ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習

Pythonデータサイエンスハンドブック 第2版 ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習

Jake VanderPlas, 菊池 彰
初めてのGraphQL ―Webサービスを作って学ぶ新世代API

初めてのGraphQL ―Webサービスを作って学ぶ新世代API

Eve Porcello, Alex Banks, 尾崎 沙耶, あんどうやすし

Publisher Resources

ISBN: 9784873118413Other