0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pandasのseriesにインデックスのリストを渡してまとめて処理する

Posted at

seriesにリストを渡せることを知ったので具体例を書いておきます。

まず適当にseriesを生成して、

import pandas as pd

labels = ["a","b","c","d","e"]

series = pd.Series(index=labels)

a NaN
b NaN
c NaN
d NaN
e NaN

series[["a","b","e"]] = [1,2,3]

a 1.0
b 2.0
c NaN
d NaN
e 3.0

まとめて処理できて便利そうです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?