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を使ったデータ分析、機械学習
102
3
章 
pandas
を使ったデータ操作
In[15]: pd.Series(5, index=[100, 200, 300])
Out[15]: 100 5
200 5
300 5
dtype: int64
data
に辞書を使うと、デフォルトではソートされた辞書のキーをインデクスとします。
In[16]: pd.Series({2:'a', 1:'b', 3:'c'})
Out[16]: 1 b
2 a
3 c
dtype: object
どちらの場合でも、明示的に設定したインデクスが優先されます。
In[17]: pd.Series({2:'a', 1:'b', 3:'c'}, index=[3, 2])
Out[17]: 3 c
2 a
dtype: object
この場合、
Series
オブジェクトには明示的に指定されたキーのみが設定されます。
3.2.2
DataFrame
オブジェクト
次の基本構造は
DataFrame
です。
Series
オブジェクトと同様に、
DataFrame
NumPy
配列の一般
化、または
Python
辞書の特殊化として考えることができます。それぞれの視点で
DataFrame
を見
てみましょう。
3.2.2.1
 一般化
NumPy
配列としての
DataFrame
Series
を柔軟なインデクスを持つ
1
次元配列に例えたように、
DataFrame
は、柔軟な行インデク
スと柔軟な列名の両方を持つ
2
次元配列に例えられます。
2
次元配列を、整列した
1
次元配列の順
序付き配列と考えるのと同様に、
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