WattTime / pyiso

Python client libraries for ISO and other power grid data sources.
http://pyiso.readthedocs.org/
Other
237 stars 110 forks source link

Fixes read_excel(parse_cols=[...]) bug starting with pandas 0.21 #174

Closed r24mille closed 6 years ago

r24mille commented 6 years ago

The continuous integration builds have been failing since c015878. This is no fault of our own, but panas 0.21 was released around that same time and the build server is using it.

The parse_cols argument was deprecated in 0.21 in favour of usecols.

https://pandas.pydata.org/pandas-docs/version/0.21/whatsnew.html#deprecations

Though it's supposed to be backward compatible, something is broken in the unit tests. This commit changes the kwarg that the unit test is using to usecols. Although read_excel(...) in pandas < 0.21 does not document the argument (e.g. http://pandas.pydata.org/pandas-docs/version/0.20/generated/pandas.read_excel.html vs. http://pandas.pydata.org/pandas-docs/version/0.21/generated/pandas.read_excel.html) the kwarg is used internally when ._parse_excel(...) instantiates TextParser which calls _handle_usecols(...) internally. It all works; tested back to pandas 0.18 in Python 2.

We may want to bump requirements.txt and setup.py to pandas>=0.21 and use usecols elsewhere in pyiso if this turns up as a problem elsewhere.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 57.727% when pulling aa9f0e92bdca5f4140c5f348ee17b56f64e6a631 on r24mille:fix_pandas_usecols into b3fd60fc05e32eb9464a4d5d01bc214b5d8eb11b on WattTime:master.

r24mille commented 6 years ago

Actually, looking into the BPA client. This is the wrong solution. We need to fix the client itself to be compatible with pandas 0.21. I'll restrict version in requirements.txt until then.