diff --git a/.travis.yml b/.travis.yml index d9274d8..b6fc8cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ install: - pip install --upgrade pip setuptools - pip install -r dev-requirements.txt - pip install -r requirements.txt + - pip install pandas==0.19 ; python_version==3.5 - pip install -e . before_script: flake8 civismlext script: diff --git a/CHANGELOG.md b/CHANGELOG.md index 6451fde..9623945 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Fixed ``DataFrameETL`` transformations of ``DataFrame``s with non-trivial index when preserving ``DataFrame`` output type (#32, #33) +- Add ``pandas`` version restrictions by Python version (#37) +- Fix code which was incompatible with older ``pandas`` version (#37) ## [0.1.7] - 2018-03-27 ### Added diff --git a/civismlext/preprocessing.py b/civismlext/preprocessing.py index 72b5be8..24476dc 100644 --- a/civismlext/preprocessing.py +++ b/civismlext/preprocessing.py @@ -94,7 +94,7 @@ def _flag_nulls(self, X, cols_to_drop): def _check_sentinels(self, X): """Replace default sentinel with random values if the default appears in the data.""" - vals = chain.from_iterable(pd.unique(X[col]).tolist() for + vals = chain.from_iterable(pd.unique(X[col]) for col in self._cols_to_expand) while any(u == self._nan_sentinel for u in vals): diff --git a/requirements.txt b/requirements.txt index a27674f..1e13cd9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,7 @@ scikit-learn>=0.18.1,<0.20 scipy>=0.14,<2.0 numpy~=1.10 -pandas~=0.19 +pandas~=0.19; python_version >= '3.5' +pandas>=0.19,<0.21; python_version == '3.4' +pandas>=0.19,<=0.23; python_version == '2.7' six~=1.10