Unable to execute xlsx file

df = pd.read_excel("C:\python\Pandas\weather.xlsx","sheet1") 
df

Error :  c:\users\usha\appdata\local\programs\python\python37-32\lib\site-packages\pandas\io\excel.py in __init__(self, io, **kwds)
    352             import xlrd
    353         except ImportError:
--> 354             raise ImportError(err_msg)
    355         else:
    356             ver = tuple(map(int, xlrd.__VERSION__.split(".")[:2]))

ImportError: Install xlrd >= 0.9.0 for Excel support

CMD :

C:\python\Pandas>pip install --upgrade xlrd
Requirement already up-to-date: xlrd in c:\users\usha\anaconda3\lib\site-packages (1.1.0)

Upvotes: 0

Views: 41

Answers (1)

Biswadip Mandal
Biswadip Mandal

Reputation: 544

This is probably because you are executing your script using python3, while you are checking for xlrd support in python2 (pip command works for python2 by default. Use pip3 for python3). You should install xlrd using the following command for python 3

pip3 install xlrd

Alternatively, you can run your code in python2. Hope this helps

Upvotes: 2

Related Questions