You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The difference between specifying the column selector as `'column'` (as a simple string) and `['column']` (as a list with one element) is the shape of the array that is passed to the transformer. In the first case, a one dimensional array with be passed, while in the second case it will be a 2-dimensional array with one column, i.e. a column vector.
71
+
The difference between specifying the column selector as ``'column'`` (as a simple string) and ``['column']`` (as a list with one element) is the shape of the array that is passed to the transformer. In the first case, a one dimensional array with be passed, while in the second case it will be a 2-dimensional array with one column, i.e. a column vector.
72
72
73
-
This behaviour mimics the same pattern as pandas' dataframes `__getitem__` indexing:
73
+
This behaviour mimics the same pattern as pandas' dataframes ``__getitem__`` indexing:
74
74
75
75
>>> data['children'].shape
76
76
(8,)
77
77
>>> data[['children']].shape
78
78
(8, 1)
79
79
80
-
Be aware that some transformers expect a 1-dimensional input (the label-oriented ones) while some others, like `OneHotEncoder` or `Imputer`, expect 2-dimensional input, with the shape `[n_samples, n_features]`.
80
+
Be aware that some transformers expect a 1-dimensional input (the label-oriented ones) while some others, like ``OneHotEncoder`` or ``Imputer``, expect 2-dimensional input, with the shape ``[n_samples, n_features]``.
81
81
82
82
Test the Transformation
83
83
***********************
@@ -161,7 +161,7 @@ Only columns that are listed in the DataFrameMapper are kept. To keep a column b
161
161
Working with sparse features
162
162
****************************
163
163
164
-
`DataFrameMapper`s will return a dense feature array by default. Setting `sparse=True` in the mapper will return a sparse array whenever any of the extracted features is sparse. Example:
164
+
``DataFrameMapper``s will return a dense feature array by default. Setting `sparse=True` in the mapper will return a sparse array whenever any of the extracted features is sparse. Example:
165
165
166
166
>>> mapper4 = DataFrameMapper([
167
167
... ('pet', CountVectorizer()),
@@ -195,7 +195,7 @@ Changelog
195
195
196
196
* Use ``sklearn.pipeline.Pipeline`` instead of copying its code. Resolves #43.
197
197
* Raise ``KeyError`` when selecting unexistent columns in the dataframe. Fixes #30.
198
-
* Return sparse feature array if any of the features is sparse and `sparse` argument is `True`. Defaults to `False` to avoid potential breaking of existing code. Resolves #34.
198
+
* Return sparse feature array if any of the features is sparse and ``sparse`` argument is ``True``. Defaults to ``False`` to avoid potential breaking of existing code. Resolves #34.
199
199
* Return model and prediction in custom CV classes. Fixes #27.
0 commit comments