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を使ったデータ分析、機械学習
72
2
章 
NumPy
の基礎
演算子 等価なufunc
== np.equal
!= np.not_equal
< np.less
<= np.less_equal
> np.greater
>= np.greater_equal
算術演算の場合と同様に、これらは任意のサイズおよび形状を持つ配列で動作します。
2
次元の
例を示します。
In[12]: rng = np.random.RandomState(0)
x = rng.randint(10, size=(3, 4))
x
Out[12]: array([[5, 0, 3, 3],
[7, 9, 3, 5],
[2, 4, 7, 6]])
In[13]: x < 6
Out[13]: array([[ True, True, True, True],
[False, False, True,
True],
[ True, True, False, False]], dtype=bool)
いずれの場合も、結果はブール値配列であり、
NumPy
はこれらのブール値の結果を扱うための
簡単なパターンをいくつか提供します。
2.6.3
 ブール値配列の操作
ブール値配列を与えると実行できる便利な操作が多数あります。先に作成した
2
次元配列
x
使って例を示します。
In[14]: print(x)
[[5 0 3 3]
[7 9 3 5]
[2 4 7 6]]
2.6.3.1
 要素のカウント
ブール値配列の
True
エントリの数を数えるには、
np.count_nonzero
を使います。 ...
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