找不到 Python Pandas read_excel() 模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20807541/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 21:29:36  来源:igfitidea点击:

Python Pandas read_excel() module not found

pythonpandas

提问by user2397611

I'm currently trying to use pandas.read_excel() to import an .xlsx file using this basic script

我目前正在尝试使用 pandas.read_excel() 使用此基本脚本导入 .xlsx 文件

import pandas as pd
x = pd.read_excel("crypt_db.xlsx", "sheet1")

and I get a module ('read_excel') not found error. Could I get some help on this?

我得到一个模块 ('read_excel') not found 错误。我能得到一些帮助吗?

My pandas is updated to the latest version.

我的Pandas已更新到最新版本。

Thank you for your help

感谢您的帮助

Full traceback

完整追溯

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'read_excel'

回答by waitingkuo

Install package xlrd:

安装包xlrd

pip install xlrd

回答by Tharp

sheet1is the Excel table sheet1's true name? if not,maybe you can try by sheet1's true name or use the sheet1's index like,

sheet1Excel表格sheet1的真名是什么?如果没有,也许您可​​以尝试通过 sheet1 的真实名称或使用 sheet1 的索引,例如,

x = pd.read_excel("crypt_db.xlsx", 0)

回答by Klevy

I got the message when upgrading pandas, but xlrdwas not updated. Run this:

我在升级Pandas时收到消息,但xlrd没有更新。运行这个:

pip install --upgrade xlrd