Selecting Pandas Columns by dtype

后端 未结 9 2048
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-29 01:22

I was wondering if there is an elegant and shorthand way in Pandas DataFrames to select columns by data type (dtype). i.e. Select only int64 columns from a DataFrame.

<
9条回答
  •  爱一瞬间的悲伤
    2020-11-29 01:54

    Multiple includes for selecting columns with list of types for example- float64 and int64

    df_numeric = df.select_dtypes(include=[np.float64,np.int64])
    

提交回复
热议问题