簡體   English   中英

找不到 Python Pandas read_excel() 模塊

[英]Python Pandas read_excel() module not found

我目前正在嘗試使用 pandas.read_excel() 使用此基本腳本導入 .xlsx 文件

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

我得到一個未找到模塊('read_excel')的錯誤。 我能得到一些幫助嗎?

我的熊貓已更新到最新版本。

謝謝您的幫助

完整回溯

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

安裝包xlrd

pip install xlrd

sheet1是 Excel 表格 sheet1 的真名嗎? 如果沒有,也許您可​​以嘗試使用 sheet1 的真實姓名或使用 sheet1 的索引,例如,

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

我在升級 pandas 時收到了消息,但xlrd沒有更新。 運行這個:

pip install --upgrade xlrd

這對我有用:

#import player regular season
df = pd.read_excel ("Player-Data-Set/NBA-Player-Statistics-season.xlsx", [0,1,2,3,4])

謝謝你 Chanda Korat 你的帖子讓我走上了正軌

在 cmd 中運行以下命令:

  pip install openpyxl    

openpyxl是一個 Python 庫,用於讀取/寫入 Excel 2010 xlsx/xlsm/xltx/xltm 文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM