IAMconsortium / pyam

Analysis & visualization of energy & climate scenarios
https://pyam-iamc.readthedocs.io/
Apache License 2.0
222 stars 116 forks source link

Remove 'xls' as by-default-supported file format #708

Closed danielhuppmann closed 1 year ago

danielhuppmann commented 1 year ago

Please confirm that this PR has done the following:

Description of PR

This PR

When a user tries to import an xls-file, pandas will show this error message

ImportError: Missing optional dependency 'xlrd'. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.

Install xlrd manually and it will work fine - and there is a test to prove it.

Writing to xls is not support any more by pandas.

closes #706

codecov[bot] commented 1 year ago

Codecov Report

Merging #708 (f2068e9) into main (947d8c4) will decrease coverage by 0.0%. The diff coverage is 87.5%.

@@           Coverage Diff           @@
##            main    #708     +/-   ##
=======================================
- Coverage   94.8%   94.8%   -0.1%     
=======================================
  Files         58      58             
  Lines       5899    5907      +8     
=======================================
+ Hits        5598    5604      +6     
- Misses       301     303      +2     
Impacted Files Coverage Δ
pyam/iiasa.py 86.7% <ø> (ø)
tests/test_iiasa.py 97.8% <ø> (-0.1%) :arrow_down:
tests/test_io.py 98.4% <85.7%> (-1.6%) :arrow_down:
pyam/core.py 94.5% <87.5%> (ø)
pyam/utils.py 91.6% <100.0%> (-0.1%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

danielhuppmann commented 1 year ago

@Rlamboll, in line with our earlier discussions, I tried to have the cake and eat it, too - reading xls is now properly supported (again), but only with a dedicated step for a user of installing the xlrd package - and with a test to prove that it works...

Plus we let pandas handle file-types and engines natively, which is less overhead in our code and probably more forward-compatible.