33
13

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の1重と2重括弧の違い

Posted at

pandasの2重括弧について

DataFrameから特定のcolumnをdf['column']取り出すと、typeがSeriesになってしまい、扱いにくい場合がある。実は2重カッコを使うと、DataFrameとして取れるので、こっちの方が便利。

# df1 is Series
df1=df['column0']   # Series

# df2 is DataFrame
df2=df[['column0']] # DataFrame 

33
13
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
33
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?