Skip to content

Commit ab02e0f

Browse files
committed
updated test cases
1 parent 4fac09e commit ab02e0f

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

sklearn_pandas/dataframe_mapper.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class DataFrameMapper(BaseEstimator, TransformerMixin):
7070
"""
7171

7272
def __init__(self, features, default=False, sparse=False, df_out=False,
73-
input_df=False, show_progress=False):
73+
input_df=False, show_progressbar=False):
7474
"""
7575
Params:
7676
@@ -102,6 +102,9 @@ def __init__(self, features, default=False, sparse=False, df_out=False,
102102
input_df If ``True`` pass the selected columns to the transformers
103103
as a pandas DataFrame or Series. Otherwise pass them as a
104104
numpy array. Defaults to ``False``.
105+
106+
show_progressbar if ``True`` a progress bar will be shown during fit
107+
and transform method. Defaults to ``False``
105108
"""
106109
self.features = features
107110
self.built_features = None
@@ -111,7 +114,7 @@ def __init__(self, features, default=False, sparse=False, df_out=False,
111114
self.df_out = df_out
112115
self.input_df = input_df
113116
self.transformed_names_ = []
114-
self.show_progress = show_progress
117+
self.show_progressbar = show_progressbar
115118

116119
if (df_out and (sparse or default)):
117120
raise ValueError("Can not use df_out with sparse or default")
@@ -211,7 +214,7 @@ def fit(self, X, y=None):
211214
212215
"""
213216
self._build()
214-
pbar = tqdm(self.built_features, disable=not self.show_progress)
217+
pbar = tqdm(self.built_features, disable=not self.show_progressbar)
215218
for columns, transformers, options in pbar:
216219
pbar.set_description("[Fit] %s" % columns)
217220
input_df = options.get('input_df', self.input_df)
@@ -290,10 +293,9 @@ def _transform(self, X, y=None, do_fit=False):
290293
if do_fit:
291294
self._build()
292295

293-
294296
extracted = []
295297
self.transformed_names_ = []
296-
pbar = tqdm(self.built_features, disable=not self.show_progress)
298+
pbar = tqdm(self.built_features, disable=not self.show_progressbar)
297299
for columns, transformers, options in pbar:
298300
pbar.set_description("[Transform] %s" % columns)
299301
input_df = options.get('input_df', self.input_df)

tests/test_dataframe_mapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import pandas as pd
1515
from scipy import sparse
1616
from sklearn import __version__ as sklearn_version
17-
from sklearn.cross_validation import cross_val_score as sklearn_cv_score
17+
from sklearn.model_selection import cross_val_score as sklearn_cv_score
1818
from sklearn.datasets import load_iris
1919
from sklearn.pipeline import Pipeline
2020
from sklearn.svm import SVC

tox.ini

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
[tox]
2-
envlist = {py27,py36}-sklearn{17,18,19}-pandas{19,22}
2+
envlist = {py36}-sklearn{23}-pandas{1}
33

44
[testenv]
55
deps =
6-
pytest==3.2.1
7-
setuptools==39.0
8-
wheel==0.24.0
9-
flake8==2.4.1
10-
numpy==1.14.3
11-
scipy==0.18.1
12-
pandas19: pandas==0.19.2
13-
pandas22: pandas==0.22.0
14-
sklearn17: scikit-learn==0.17.1
15-
sklearn18: scikit-learn==0.18.1
16-
sklearn19: scikit-learn==0.19.1
17-
py27: mock==1.3.0
6+
pytest==5.3.5
7+
setuptools==45.2
8+
wheel==0.34.2
9+
flake8==3.7.9
10+
numpy==1.18.1
11+
scipy==1.4.1
12+
pandas1: pandas==1.0.5
13+
sklearn23: scikit-learn==0.23.1
1814

1915
commands =
2016
flake8 --exclude build

0 commit comments

Comments
 (0)