user2397611
user2397611

Reputation: 49

Python Pandas read_excel() module not found

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

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?

My pandas is updated to the latest version.

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'

Upvotes: 3

Views: 14122

Answers (6)

Prashant Boorugu
Prashant Boorugu

Reputation: 1

AttributeError: partially initialized module 'pandas' has no attribute 'read_excel' (most likely due to a circular import)

I faced a similar problem

it got solved when I renamed org.py to organization.py

There are references to packages
org.python.core

org.py is being read as package hence the problem...

please be aware when naming python files.

Upvotes: 0

ankita rm
ankita rm

Reputation: 21

Run the below command in cmd:

  pip install openpyxl    

openpyxl is a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files.

Upvotes: 2

Daniel Albert
Daniel Albert

Reputation: 76

This did the trick for me:

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

Thank you Chanda Korat your post put me on the right track

Upvotes: 0

Klevy
Klevy

Reputation: 11

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

pip install --upgrade xlrd

Upvotes: 1

Tharp
Tharp

Reputation: 11

sheet1 is 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,

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

Upvotes: 1

waitingkuo
waitingkuo

Reputation: 93774

Install package xlrd:

pip install xlrd

Upvotes: 4

Related Questions