Numpy在使用Read_Excel时没有float属性错误。

huangapple go评论54阅读模式
英文:

Numpy has no float attribute error when using Read_Excel

问题

当我尝试使用pandas读取一个xlsx文件时,我收到错误消息"numpy has no float attribute",但是在我的代码中没有使用numpy,我在使用以下代码时收到这个错误:

info = pd.read_excel(path_info)

我使用的xlsx文件中只包含一些文字用于测试,没有数字或浮点数。

我想知道如何解决这个错误。

我尝试创建不同的文件,还尝试将我的info类型指定为pd.dataframe。

Python版本 3.11
Pandas版本 1.5.3

英文:

When I try to read a xlsx file using pandas, I receive the error "numpy has no float attribute", but I'm not using numpy in my code, I get this error when using the code below

info = pd.read_excel(path_info)

The xlsx file I'm using has just some letters inside of it for test purpouses, there's no numbers or floats.

What I want to know is how can I solve that bug or error.

I tried to create different files, change my info type to specify a pd.dataframe too

Python Version 3.11
Pandas Version 1.5.3

答案1

得分: 6

你可以通过将openpyxl升级到最新版本来解决这个问题。
在你的jupyter单元格中使用下面提到的代码片段并执行。

!pip install openpyxl --upgrade
英文:

You can solve this issue by simply upgrading the openpyxl to latest version.
use the below mention snippet in your jupyter cell and execute.

!pip install openpyxl --upgrade

答案2

得分: 0

已经解决了相同的问题。通过将openpyxl更新到最新版本来修复它。

英文:

Had the same problem. Fixed it by updating openpyxl to latest version.

huangapple
  • 本文由 发表于 2023年2月8日 21:54:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/75386792.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定