GEOparse
GEOparse copied to clipboard
Fix failing tests: Add compatibility with pandas 2
Closes #84
Compatibility with pandas 2
Problem:
For a pandas dataframe that contains both numeric and string columns, the mean() function started to fail in pandas 2.0+ because the default behavior has changed from mean(numeric_only=True) to mean(numeric_only=False) (link).
Solution:
Ensure we only have numeric columns.
Testing:
- Tested with pandas 1.3.0 (Python 3.8) and pandas 2.2.2 (Python 3.12).
- Here is a test with isolated functionality to test only the
pandasdependency in both environments: [GEOParse] Non-breaking change compatible with pandas 1.3.0 and 2.2.2
Compatibility with tox 4
1. Whitespace in the environmental variables
With tox==4.16.0, the tox command was failing with the following error:
py38: failed with pass_env values cannot contain whitespace, use comma to have multiple values in a single line, invalid values found 'GEOPARSE_USE_HTTP_FOR_FTP *_proxy *_PROXY USER'
The modified line also works in tox==3.14.3 (Dec 28, 2019). However, I couldn't run tox==3.13.0 (Jun 25, 2019) regardless of this line.
2. Explicit lxml dependency
Without the lxml dependency, 3 tests were failing:
FAILED test_GEOparse.py::TestGSM::test_download_SRA - ImportError: lxml not found, please install or use the etree parser.
FAILED test_GEOparse.py::TestGSM::test_download_SRA_parallel_by_gsm - ImportError: lxml not found, please install or use the etree parser.
FAILED test_GEOparse.py::TestGSM::test_download_SRA_parallel_by_sra - ImportError: lxml not found, please install or use the etree parser.
========================================================== 3 failed, 32 passed in 58.25s