Skip to content

Commit e6f58b6

Browse files
committed
Add documentation example selecting column but not applying any transformer to it.
1 parent 4ae4c1c commit e6f58b6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.rst

+19
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,25 @@ Now running ``fit_transform`` will run PCA on the ``children`` and ``salary`` co
112112
[ -6.4],
113113
[-15.4]])
114114

115+
Columns that don't need any transformation
116+
******************************************
117+
118+
Only columns that are listed in the DataFrameMapper are kept. To keep a column but don't apply any transformation to it, use `None` as transformer::
119+
120+
>>> mapper3 = DataFrameMapper([
121+
... ('pet', sklearn.preprocessing.LabelBinarizer()),
122+
... ('children', None)
123+
... ])
124+
>>> np.round(mapper3.fit_transform(data))
125+
array([[ 1., 0., 0., 4.],
126+
[ 0., 1., 0., 6.],
127+
[ 0., 1., 0., 3.],
128+
[ 0., 0., 1., 3.],
129+
[ 1., 0., 0., 2.],
130+
[ 0., 1., 0., 3.],
131+
[ 1., 0., 0., 5.],
132+
[ 0., 0., 1., 4.]])
133+
115134
Cross-Validation
116135
----------------
117136

0 commit comments

Comments
 (0)