Skip to content

Commit 6339ccd

Browse files
author
Brendan Herger
committed
Updating docs, updating fill_value reference in README
1 parent 369703e commit 6339ccd

File tree

5 files changed

+30
-7
lines changed

5 files changed

+30
-7
lines changed

.pytest_cache/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# pytest cache directory #
2+
3+
This directory contains data from the pytest's cache plugin,
4+
which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
5+
6+
**Do not** commit this to version control.
7+
8+
See [the docs](https://docs.pytest.org/en/latest/cache.html) for more information.

.pytest_cache/v/cache/lastfailed

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"tests/test_categorical_imputer.py::test_unit[np-None]": true,
3+
"tests/test_categorical_imputer.py::test_unit[np-nan]": true,
4+
"tests/test_categorical_imputer.py::test_unit[pd-None]": true,
5+
"tests/test_categorical_imputer.py::test_unit[pd-nan]": true
6+
}

.pytest_cache/v/cache/nodeids

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
"tests/test_categorical_imputer.py::test_unit[np-None]",
3+
"tests/test_categorical_imputer.py::test_unit[np-nan]",
4+
"tests/test_categorical_imputer.py::test_unit[pd-None]",
5+
"tests/test_categorical_imputer.py::test_unit[pd-nan]"
6+
]

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ Example: imputing with a fixed value:
401401

402402
>>> from sklearn_pandas import CategoricalImputer
403403
>>> data = np.array(['a', 'b', 'b', np.nan], dtype=object)
404-
>>> imputer = CategoricalImputer(strategy='fixed_value', replacement='a')
404+
>>> imputer = CategoricalImputer(strategy='constant', fill_value='a')
405405
>>> imputer.fit_transform(data)
406406
array(['a', 'b', 'b', 'a'], dtype=object)
407407

sklearn_pandas/categorical_imputer.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,20 @@ class CategoricalImputer(BaseEstimator, TransformerMixin):
3333
copy : boolean, optional (default=True)
3434
If True, a copy of X will be created.
3535
36-
strategy : string, optional (default = 'mode')
37-
If set to 'mode', replace all instances of `missing_values`
38-
with the modal value. Otherwise, replace with
39-
the value specified via `replacement`.
36+
strategy : string, optional (default = 'most_frequent')
37+
The imputation strategy.
38+
39+
- If "most_frequent", then replace missing using the most frequent
40+
value along each column. Can be used with strings or numeric data.
41+
- If "constant", then replace missing values with fill_value. Can be
42+
used with strings or numeric data.
4043
4144
replacement : string, optional (default='?')
4245
The value that all instances of `missing_values` are replaced
43-
with if `strategy` is not set to 'mode'. This is useful if
46+
with if `strategy` is set to `constant`. This is useful if
4447
you don't want to impute with the mode, or if there are multiple
4548
modes in your data and you want to choose a particular one. If
46-
`strategy` is set to `mode`, this parameter is ignored.
49+
`strategy` is not set to `constant`, this parameter is ignored.
4750
4851
Attributes
4952
----------

0 commit comments

Comments
 (0)