Skip to content Skip to sidebar Skip to footer

Why Won't Pandas.read_excel Run?

I am trying to use pandas.read_excel but I keep getting ' 'module' object has no attribute 'read_excel' ' as an error in my terminal as shown File 'read.py', line 9, in

Solution 1:

df = pd.read_excel(filepath + 'Result.xlsx')

Check whether the extension of excel file is xls or xlsx then add the same in the query. I tried and its is working fine now.

Solution 2:

You probably mean pd.io.excel.read_excel()

Solution 3:

The problem is that your script is called "read.py". The Python file that defines read_excel already imports another module called "read" - so when you try and run your "read.py" script, it squashes the old "read" module that pandas is using, and thus breaks read_excel. This problem can happen with other "common" short names for scripts, like "email.py".

Try renaming your script.

Post a Comment for "Why Won't Pandas.read_excel Run?"