Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
samukweku committed Feb 1, 2023
1 parent 0ae5762 commit 5aff13b
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions janitor/functions/impute.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,22 @@ def impute(
1 2 NaN 3.0
2 3 NaN 2.0
:param df: A pandas DataFrame.
:param column_names: The name of the column(s) on which to impute values.
:param value: The value used for imputation, passed into `.fillna` method
of the underlying pandas Series.
:param statistic_column_name: The column statistic to impute.
:returns: An imputed pandas DataFrame.
:raises ValueError: If both `value` and `statistic_column_name` are
provided.
:raises KeyError: If `statistic_column_name` is not one of `mean`,
`average`, `median`, `mode`, `minimum`, `min`, `maximum`, or `max`.
Args:
df: A pandas DataFrame.
column_names: The name of the column(s) on which to impute values.
value: The value used for imputation, passed into `.fillna` method
of the underlying pandas Series.
statistic_column_name: The column statistic to impute.
Raises:
ValueError: If both `value` and `statistic_column_name` are
provided.
KeyError: If `statistic_column_name` is not one of `mean`,
`average`, `median`, `mode`, `minimum`, `min`, `maximum`, or
`max`.
Returns:
An imputed pandas DataFrame.
"""
# Firstly, we check that only one of `value` or `statistic` are provided.
if (value is None) and (statistic_column_name is None):
Expand Down

0 comments on commit 5aff13b

Please sign in to comment.