Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xlrd > 2.0.0 only supports .xls files #25

Open
MJHutchinson opened this issue Feb 26, 2021 · 6 comments
Open

xlrd > 2.0.0 only supports .xls files #25

MJHutchinson opened this issue Feb 26, 2021 · 6 comments

Comments

@MJHutchinson
Copy link
Member

The requirement xlrd > 1.0.0 now causes issues with the new release of xlrd as the latest version only supports xls files.

Best fix is to use openpyxl (https://openpyxl.readthedocs.io/en/stable/) instead

@ywteh
Copy link
Member

ywteh commented Feb 26, 2021 via email

@MJHutchinson
Copy link
Member Author

MJHutchinson commented Feb 26, 2021

A clean install of the library threw the following error

Traceback (most recent call last):
  File "/data/ziz/not-backed-up/mhutchin/Rmap-dev/Rmap/dataprocessing/process_uk_cases.py", line 5, in <module>
    uk_data = UKCovid19Data(england_area_type=UKCovid19Data.ENGLAND_LOWER_TIER_AUTHORITY)
  File "/data/ziz/not-backed-up/mhutchin/Rmap-dev/Rmap/dataprocessing/covid19_datasets/covid19_datasets/uk_area_stats.py", line 132, in __init__
    UKCovid19Data.wales_cases_data, UKCovid19Data.wales_tests_data = _load_wales_datasets()
  File "/data/ziz/not-backed-up/mhutchin/Rmap-dev/Rmap/dataprocessing/covid19_datasets/covid19_datasets/uk_area_stats.py", line 60, in _load_wales_datasets
    xlsx = pd.ExcelFile(WALES_PATH)
  File "/data/ziz/mhutchin/miniconda3/envs/Rmap2/lib/python3.9/site-packages/pandas/io/excel/_base.py", line 1102, in __init__
    raise ValueError(
ValueError: Your version of xlrd is 2.0.1. In xlrd >= 2.0, only the xls format is supported. Install openpyxl instead.

so maybe the requirements file needs updating?

@ywteh
Copy link
Member

ywteh commented Feb 26, 2021 via email

@upaq
Copy link
Member

upaq commented Feb 26, 2021

should the requirements be updated by removing xlrd >= 1.0.0 and adding openpyxl >= 3.0.0 ?

@ywteh
Copy link
Member

ywteh commented Feb 26, 2021 via email

@williamse497
Copy link

williamse497 commented Jun 22, 2021

You need to make sure that you are on a recent version of Pandas; at least 1.0.1, 1.2.0...,
then install openpyxl: pip install openpyxl or Go to-> https://openpyxl.readthedocs.io/en/stable/
On your Pandas Code base that read: ->pandas.read_excel('cat.xlsx')
Change it to:
pandas.read_excel('cat.xlsx', engine='openpyxl')

Or
you can inatall the older version of xlrd: pip install xlrd==1.2.0

Because the latest version of xlrd(2.0.1) only support xls files extensions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants