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を使ったデータ分析、機械学習
94
2
章 
NumPy
の基礎
構造化配列の便利な点は、インデクスまたは名前のいずれかで値を参照できるようになったこと
です。
In[6]: # Get all names
すべての
name
を表示する
data['name']
Out[6]: array(['Alice', 'Bob', 'Cathy', 'Doug'],
dtype='<U10')
In[7]: # Get first row of data
最初の行を表示する
data[0]
Out[7]: ('Alice', 25, 55.0)
In[8]: # Get the name from the last row
最後の行の
name
を表示する
data[-1]['name']
Out[8]: 'Doug'
ブール値マスキングと組み合わせれば、年齢による絞り込みなど、より洗練された操作も可能と
なります。
In[9]: # Get names where age is under 30 age
30
以下の
name
を表示する
data[data['age'] < 30]['name']
Out[9]: array(['Alice', 'Doug'],
dtype='<U10')
これより複雑な操作が必要な場合は、次の章で説明する
pandas
パッケージの使用を検討してく
ださい。
pandas
には、
NumPy
配列上に構築された構造体である
DataFrame
オブジェクトが用意さ
れており、ここで示した以上の便利で多彩なデータ操作機能を提供します。 ...
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