Skip to content

Commit b803d8e

Browse files
authored
DOC: clarify behavior of 'cols' parameter in ApplyToCols and ApplyToFrame (#1670)
1 parent 6e03d24 commit b803d8e

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

skrub/_apply_to_cols.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ class ApplyToCols(TransformerMixin, BaseEstimator):
204204
"""Map a transformer to columns in a dataframe.
205205
206206
A separate clone of the transformer is applied to each column separately.
207+
All columns not listed in ``cols`` remain unmodified in the output.
207208
Moreover, if ``allow_reject`` is ``True`` and the transformers'
208209
``fit_transform`` raises a ``RejectColumn`` exception for a particular
209210
column, that column is passed through unchanged. If ``allow_reject`` is
@@ -233,9 +234,10 @@ class ApplyToCols(TransformerMixin, BaseEstimator):
233234
the output.
234235
235236
cols : str, sequence of str, or skrub selector, optional
236-
The columns to attempt to transform. Columns outside of this selection
237-
will be passed through unchanged, without attempting to call
238-
``fit_transform`` on them. The default is to attempt transforming all
237+
The columns to attempt to transform. Only the selected columns will have
238+
the transformer applied. Columns outside this selection are passed
239+
through unchanged (``fit_transform`` is not called on them) and remain
240+
unmodified in the output. The default is to attempt transforming all
239241
columns.
240242
241243
allow_reject : bool, default=False

skrub/_apply_to_frame.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class ApplyToFrame(TransformerMixin, BaseEstimator):
1414
A subset of the dataframe is selected and passed to the transformer (as a
1515
single input). This is different from ``ApplyToCols``, which fits a
1616
separate clone of the transformer to each selected column independently.
17+
All columns not listed in ``cols`` remain unmodified in the output.
1718
1819
.. note::
1920
@@ -30,9 +31,10 @@ class ApplyToFrame(TransformerMixin, BaseEstimator):
3031
will appear unchanged in the output.
3132
3233
cols : str, sequence of str, or skrub selector, optional
33-
The columns to attempt to transform. Columns outside of this selection
34-
will be passed through unchanged, without calling ``fit_transform`` on
35-
them. The default is to transform all columns.
34+
The columns to attempt to transform. Only the selected columns will have
35+
the transformer applied. Columns outside of this selection are passed
36+
through unchanged (``fit_transform`` is not called on them) and remain
37+
unmodified in the output. The default is to transform all columns.
3638
3739
keep_original : bool, default=False
3840
If ``True``, the original columns are preserved in the output. If the

0 commit comments

Comments
 (0)