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(
Since December 2020 xlrd no longer supports xlsx-Files as explained in the official changelog. You can use openpyxl
instead:
pip install openpyxl
And in your python-file:
import pandas as pd
pd.read_excel('path/to/file.xlsx', engine='openpyxl')
First of all you need to install xlrd & pandas packages. Then try below code.
import xlrd
import pandas as pd
xl = pd.ExcelFile("fileName.xlsx")
print(xl.parse(xl.sheet_names[0]))
I had the same problem and none of the above answers worked. If you go into the settings (CTRL + ALT + s) and search for project interpreter you will see all of the installed packages. Click the + button at the top right and search for xlrd, then click install package at the bottom left.
I had already done the "pip install xlrd" command from the file location of my python.exe before this, so you may need to do that as well. (you can find the file location by searching it in windows search bar and right click -> open file location, then type cmd into the file explorer address bar)
Either use:
pip install xlrd
And if you are using conda, use
conda install -c anaconda xlrd
That's it. good luck.
As @COLDSPEED so eloquently pointed out the error explicitly tells you to install xlrd.
pip install xlrd
And you will be good to go.
You need to install the "xlrd" lib
For Linux (Ubuntu and Derivates):
Installing via pip: python -m pip install --user xlrd
Install system-wide via a Linux package manager: *sudo apt-get install python-xlrd
Windows:
Installing via pip: *pip install xlrd
Download the files: https://pypi.org/project/xlrd/