Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: Pandas pd.read_excel giving ImportError: Install xlrd >= 0.9.0 for Excel support

People also ask

Do I need XLRD for pandas?

Pandas uses the xlrd as their default engine for reading excel files. However, xlrd has removed support for anything other than xls files in their latest release.

What is read_excel in pandas?

pandas. read_excel() function is used to read excel sheet with extension xlsx into pandas DataFrame. By reading a single sheet it returns a pandas DataFrame object, but reading two sheets it returns a Dict of DataFrame.


As @COLDSPEED so eloquently pointed out the error explicitly tells you to install xlrd.

pip install xlrd

And you will be good to go.


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')

Either use:

pip install xlrd

And if you are using conda, use

conda install -c anaconda xlrd

That's it. good luck.


I was getting an error

"ImportError: Install xlrd >= 1.0.0 for Excel support"

on Pycharm for below code

import pandas as pd
df2 = pd.read_excel("data.xlsx")
print(df2.head(3))
print(df2.tail(3))

Solution : pip install xlrd

It resolved error after using this. Also no need to use "import xlrd"