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を使ったデータ分析、機械学習
180
3
章 
pandas
を使ったデータ操作
<ipython-input-3-fc1d891ab539> in <listcomp>(.0)
1 data = ['peter', 'Paul', None, 'MARY', 'gUIDO']
----> 2 [s.capitalize() for s in data]
属性エラー:
'NoneType'
オブジェクトは、
'capitalize'
属性を持たない
 
AttributeError: 'NoneType' object has no attribute 'capitalize'
---------------------------------------------------------------------------
文字列を含む
Series
オブジェクトまたは
Index
オブジェクトの
str
属性を通して、ベクトル化さ
れた文字列操作機能と欠落データの適切な取り扱い機能の両方を、
pandas
は提供します。例えば、
このデータを使って
Series
オブジェクトを作成したとしましょう。
In[4]: import pandas as pd
names = pd.Series(data)
names
Out[4]: 0 peter
1 Paul
2 None
3 MARY
4 gUIDO
dtype: object
1
つのメソッドの呼び出しで、欠落している値をスキップしながら、すべての文字列要素を大文
字で始まる形式に変換できます。
In[5]: ...
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