I installed pandas
and matplotlib
using pip3 install
. I then ran this script:
import pandas as pd import matplotlib.pyplot as plt data = pd.ExcelFile("Obes-phys-acti-diet-eng-2014-tab.xls") print (data.sheet_names)
and received this error:
dhcp-169-233-172-97:Obesity juliushamilton$ python3 ob.py Traceback (most recent call last): File "ob.py", line 4, in <module> data = pd.ExcelFile("Obes-phys-acti-diet-eng-2014-tab.xls") File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pandas/io/excel.py", line 169, in __init__ import xlrd # throw an ImportError if we need to ImportError: No module named 'xlrd'
Why is the necessary xlrd
missing?
You've almost got it: xlrd. __VERSION__ . Usually it's useful to see available attributes and methods by calling dir: dir(xlrd) . This is extremely useful to know.
xlsx files was removed from xlrd due to a potential security vulnerability.
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. This causes you to receive the error that the xlsx filetype is no longer supported when calling the read_excel function on a xlsx excel using pandas.
Install the new module:
pip install xlrd
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With