Skip to content

Commit 24394e8

Browse files
committed
Delete obsolete PassThroughTransformer.
If no transformation is desired for a given column, use ``None`` as transformer.
1 parent 0d4f562 commit 24394e8

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ Changelog
193193
1.1.0 (development)
194194
*******************
195195

196+
* Delete obsolete ``PassThroughTransformer``. If no transformation is desired for a given column, use ``None`` as transformer.
196197
* Factor out code in several modules, to avoid having everything in ``__init__.py``.
197198
* Use custom ``TransformerPipeline`` class to allow transformation steps accepting only a X argument. Fixes #46.
198199
* Add compatibility shim for unpickling mappers with list of transformers created before 1.0.0. Fixes #45.

sklearn_pandas/__init__.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
__version__ = '1.0.0'
22

3-
import numpy as np
4-
from sklearn.base import TransformerMixin
5-
63
from .dataframe_mapper import DataFrameMapper # NOQA
74
from .cross_validation import cross_val_score, GridSearchCV, RandomizedSearchCV # NOQA
8-
9-
10-
class PassthroughTransformer(TransformerMixin):
11-
def fit(self, X, y=None, **fit_params):
12-
return self
13-
14-
def transform(self, X):
15-
return np.array(X).astype(np.float)

tests/test_dataframe_mapper.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@
2020
from numpy.testing import assert_array_equal
2121
import pickle
2222

23-
from sklearn_pandas import (
24-
DataFrameMapper,
25-
PassthroughTransformer,
26-
cross_val_score
27-
)
23+
from sklearn_pandas import DataFrameMapper, cross_val_score
2824
from sklearn_pandas.dataframe_mapper import _handle_feature, _build_transformer
2925
from sklearn_pandas.pipeline import TransformerPipeline
3026

@@ -256,10 +252,10 @@ def cars_dataframe():
256252
def test_with_iris_dataframe(iris_dataframe):
257253
pipeline = Pipeline([
258254
("preprocess", DataFrameMapper([
259-
("petal length (cm)", PassthroughTransformer()),
260-
("petal width (cm)", PassthroughTransformer()),
261-
("sepal length (cm)", PassthroughTransformer()),
262-
("sepal width (cm)", PassthroughTransformer()),
255+
("petal length (cm)", None),
256+
("petal width (cm)", None),
257+
("sepal length (cm)", None),
258+
("sepal width (cm)", None),
263259
])),
264260
("classify", SVC(kernel='linear'))
265261
])

0 commit comments

Comments
 (0)