get list of pandas dataframe columns based on data type

前端 未结 12 1384
后悔当初
后悔当初 2020-12-07 07:37

If I have a dataframe with the following columns:

1. NAME                                     object
2. On_Time                                      object
         


        
12条回答
  •  不思量自难忘°
    2020-12-07 08:04

    Using dtype will give you desired column's data type:

    dataframe['column1'].dtype
    

    if you want to know data types of all the column at once, you can use plural of dtype as dtypes:

    dataframe.dtypes
    

提交回复
热议问题