I am trying to read a .xlsx
with pandas, but get the follwing error:
data = pd.read_excel(low_memory=False, io=\"DataAnalysis1/temp1.xlsx\").fillna(
This happened to me after I ran a script with cProfile a la python3 -m cProfile script.py
even though xlrd was already installed and had never thrown this error before. it persisted even under python3 script.py
. (Granted, I agree this wasn't what happened to OP, given the obvious import error)
However, for cases like mine, the following fixed the issue, despite being told "requirement already met" in every case.
pip install --upgrade pandas
pip install --upgrade xlrd
Pretty confounding stuff; not sure if cProfile was the cause or just a coincidence
The following should work, assuming your pip install
operated on python2.
python3 -m pip install xlrd
Please make sure your python or python3 can see xlrd installation. I had a situation where python3.5 and python3.7 were installed in two different locations. While xlrd was installed with python3.5, I was using python3 (from python3.7 dir) to run my script and got the same error reported above. When I used the correct python (viz. python3.5 dir) to run my script, I was able to read the excel spread sheet without a problem.
This works for me: For Python 3
pip3 install xlrd --user
For Python2
pip install xlrd --user