pydit.wrangling.fillna.fillna_smart¶
- pydit.wrangling.fillna.fillna_smart(df_input, cols=None, numeric_fillna=0, date_fillna='latest', text_fillna='', include_empty_string=False, include_spaces=False, silent=False)[source]¶
Cleanup the values of the dataframe with opinionated nulls handling.
- Parameters:
df (pandas.DataFrame) – The dataframe to clean up
cols (list, optional, default None) – The columns to clean up. If None, will clean up all columns.
numeric_fillna (int/float, optional, default 0) – The value to fill in for numeric columns.
date_fillna (str or datetime or date, optional, default "latest") – The date to use for the nulls in the date columns. If “latest”, will use the latest date in the column. If “first”, will use the minimum date in the column. if “today”, will use today’s date. If date or datetime provided, will use that date. If str, will attempt to parse the date using “%Y-%m-%d” format.
text_fillna (str, optional, default "") – The text to use for the nulls in the text columns.
include_empty_string (bool, optional, default False) – Whether to consider empty string as nulls to fill.
include_spaces (bool, optional, default False) – Whether to consider spaces as nulls to fill.
silent (bool, optional, default False) – If True, will not print any logs (other than critical)
- Returns:
Returns a copy of the original dataframe with modifications
- Return type:
pandas.DataFrame