简体   繁体   English

AttributeError: 'df' object 没有属性 'dtype'

[英]AttributeError: 'df' object has no attribute 'dtype'

I was importing an xlsx file to Google Colab using code我正在使用代码将 xlsx 文件导入 Google Colab

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

and encountered error并遇到错误

AttributeError: 'ExcelFile' object has no attribute 'dtype'. AttributeError:“ExcelFile”object 没有属性“dtype”。

I was expecting df4 to be a DataFrame and check its shape.我期待 df4 成为 DataFrame 并检查它的形状。 How can I do this?我怎样才能做到这一点? Thank you.谢谢你。

According to documentation , the proper way to read the excel file is:根据文档,读取 excel 文件的正确方法是:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AttributeError:类型对象'object'没有属性'dtype' - AttributeError: type object 'object' has no attribute 'dtype' AttributeError: 'int' 对象没有属性 'dtype' - AttributeError: 'int' object has no attribute 'dtype' AttributeError:“ TensorSliceDataset”对象没有属性“ dtype” - AttributeError: 'TensorSliceDataset' object has no attribute 'dtype' AttributeError:“ NoneType”对象没有属性“ dtype” - AttributeError: 'NoneType' object has no attribute 'dtype' AttributeError:“列表”对象没有属性“ dtype” - AttributeError: 'list' object has no attribute 'dtype' AttributeError:'CommandQueue'对象没有属性'dtype' - AttributeError: 'CommandQueue' object has no attribute 'dtype' AttributeError: 'float' object 没有属性 'dtype' - AttributeError: 'float' object has no attribute 'dtype' 估算器API:AttributeError:'NoneType'对象没有属性'dtype' - Estimator API: AttributeError: 'NoneType' object has no attribute 'dtype' 熊猫read_csv:AttributeError:“ NoneType”对象没有属性“ dtype” - Pandas read_csv: AttributeError: 'NoneType' object has no attribute 'dtype' AttributeError: 'numpy.dtype' object 没有属性 'is_floating' - AttributeError: 'numpy.dtype' object has no attribute 'is_floating'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM