简体   繁体   中英

'DataFrame' object has no attribute 'types'

Does anyone have any ideas on why I am getting the following error when I try to print out columns data types of a df using the:

 print(df.types)

command

 AttributeError: 'DataFrame' object has no attribute 'types'

There are no duplicate values in the column names of the df.

Thanks!

There is a small typo in your example. In order to print columns data types of a dataframe you have to write: print(df.dtypes)

Here is the corresponding documentation: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.dtypes.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM