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を使ったデータ分析、機械学習
142
3
章 
pandas
を使ったデータ操作
# example DataFrame
サンプル
DataFrame
make_df('ABC', range(3))
Out[2]: A B C
0 A0 B0 C0
1 A1 B1 C1
2 A2 B2 C2
3.7.1
 再掲:
NumPy
配列の連結
Series
オブジェクトと
DataFrame
オブジェクトの連結は、
NumPy
配列の連結と非常によく似て
います。これは、「2.2 NumPy 配列の基礎」で説明した
np.concatenate
関数を使用して行います。
2
つ以上の配列を
1
つに連結できることを思い出してください。
In[4]: x = [1, 2, 3]
y = [4, 5, 6]
z = [7, 8, 9]
np.conc
atenate([x, y, z])
Out[4]: array([1, 2, 3, 4, 5, 6, 7, 8, 9])
最初の引数は、連結する配列のリストまたはタプルです。連結する軸を指定する
axis
キーワー
ドを追加することができます。
In[5]: x = [[1, 2],
[3, 4]]
np.concatenate([x, x], axis=1)
Out[5]: array([[1, 2, 1, 2],
[3, 4, 3, 4]])
3.7.2
pd.concat
を使った単純な連結
pandas
は、
np.concatenate
と似た構文で、いくつかの追加オプションを持つ
pd.concat()
関数を
提供しています。 ...
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