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を使ったデータ分析、機械学習
3.2
pandas
オブジェクトの基礎
99
In[1]: import numpy as np
import pandas as pd
3.2.1
Series
オブジェクト
pandas
Series
オブジェクトは、
1
次元のインデクス付きデータです。次のようにリストまたは
配列から作成できます。
In[2]: data = pd.Series([0.25, 0.5, 0.75, 1.0])
data
Out[2]: 0 0.25
1 0.50
2 0.75
3 1.00
dtype: float64
この出力からわかるように、
Series
は一連の値と一連のインデクスを持ち、
values
属性と
index
属性でアクセスできます。
values
は、おなじみの
NumPy
配列です。
In[3]: data.values
Out[3]: array([ 0.25, 0.5 , 0.75, 1. ])
index
は、
pd.Index
型の配列に似たオブジェクトです。これについては、後で詳しく説明します。
In[4]: data.index
Out[4]: RangeIndex(start=0, stop=4, step=1)
NumPy
配列と同様に、
Python
の角カッコ表記を使って関連するインデクスからデータにアクセ
スできます。
In[5]: data[1]
Out[5]: 0.5
In[6]: data[1:3]
Out[6]: 1 0.50
2 0.75
dtype: float64
しかし、
pandas
Series
は、それ ...
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