简体   繁体   中英

AttributeError: 'df' object has no attribute 'dtype'

I was importing an xlsx file to Google Colab using code

df = pd.ExcelFile('/content/gdrive/My Drive/df.xlsx')

and encountered error

AttributeError: 'ExcelFile' object has no attribute 'dtype'.

I was expecting df4 to be a DataFrame and check its shape. How can I do this? Thank you.

According to documentation , the proper way to read the excel file is:

dfs = pd.read_excel(file_name, sheet_name=None)

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