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を使ったデータ分析、機械学習
38
2
章 
NumPy
の基礎
Python
リスト
NumPy
配列
図2-2 NumPy配列と Pythonリストの違い
2.1.3
Python
の固定型配列
効率的に固定型のデータを格納するためのオプションを
Python
はいくつか提供しています。
Python 3.3
から利用可能となった配列モジュール
array
を使用して、一様な型の密な配列を作成す
ることができます。
In[6]: import array
L = list(range(10))
A = array.array('i', L)
A
Out[6]: array('i', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
ここで
'i'
は配列の要素が整数(
Integer
)であることを指定する型コードです。
しかし、
NumPy
パッケージの
ndarray
オブジェクトはさらに高い利便性を提供します。
Python
の配列オブジェクトは配列ベ
ースのデータを効率的に格納しますが、
NumPy
はそのデータに対
する効率的な操作を追加します。これらの操作については、後の節で説明します。ここでは、
NumPy
配列を作成するいくつかの方法を示します。
まず、慣習的な別名
np
として
NumPy
をインポートします。
In[7]: import numpy as np
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