Skip to content

Commit 629cbca

Browse files
DOC Fix Cleaner docstring formatting (#2105)
Co-authored-by: Riccardo Cappuzzo <7548232+rcap107@users.noreply.github.com>
1 parent a834090 commit 629cbca

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

skrub/_table_vectorizer.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ class Cleaner(TransformerMixin, BaseEstimator):
292292
it is forwarded to :class:`ToDatetime`. Otherwise, the format is inferred.
293293
294294
- :class:`ToFloat`:
295+
295296
- if ``parse_numbers=True``, apply :class:`ToFloat` on string columns,
296297
converting strings whose non-missing values can all be parsed as numbers
297298
to ``float32``;
@@ -302,12 +303,15 @@ class Cleaner(TransformerMixin, BaseEstimator):
302303
library (Pandas or Polars) to force consistent typing and avoid issues downstream.
303304
304305
- ``ToStr()``: convert columns to strings unless they are numerical,
305-
categorical, or datetime. This step is controlled by the ``cast_to_str``
306-
parameter. When ``cast_to_str=False`` (default), string conversion is skipped.
307-
When ``cast_to_str=True``, string conversion is applied.
306+
categorical, or datetime. This step is controlled by the ``cast_to_str``
307+
parameter. When ``cast_to_str=False`` (default), string conversion is
308+
skipped. When ``cast_to_str=True``, string conversion is applied.
309+
308310
309-
Example:
310311
312+
Examples
313+
--------
314+
>>> from skrub import Cleaner
311315
>>> import pandas as pd
312316
>>> df = pd.DataFrame({"num_str": ["1", "2"], "num": [1, 2], "f": [1.0, 2.0]})
313317
>>> Cleaner(parse_numbers=False).fit_transform(df).dtypes # doctest: +SKIP
@@ -321,11 +325,6 @@ class Cleaner(TransformerMixin, BaseEstimator):
321325
num ...
322326
f float32
323327
dtype: object
324-
325-
Examples
326-
--------
327-
>>> from skrub import Cleaner
328-
>>> import pandas as pd
329328
>>> df = pd.DataFrame({
330329
... 'A': ['one', 'two', 'two', 'three'],
331330
... 'B': ['02/02/2024', '23/02/2024', '12/03/2024', '13/03/2024'],
@@ -364,7 +363,7 @@ class Cleaner(TransformerMixin, BaseEstimator):
364363
dtype: object
365364
366365
Columns can be excluded from processing by combining the ``Cleaner`` with
367-
`:class:`~skrub.ApplyToCols`. For example, to exclude the datetime column from
366+
:class:`~skrub.ApplyToCols`. For example, to exclude the datetime column from
368367
processing and keep it as a string, we can do:
369368
370369
>>> from skrub import ApplyToCols

0 commit comments

Comments
 (0)