Null handlers
Module with null handlers transformers.
NullHandlers
¶
Bases: object
Class containing null handler transformers.
Source code in mkdocs/lakehouse_engine/packages/transformers/null_handlers.py
replace_nulls(replace_on_nums=True, default_num_value=-999, replace_on_strings=True, default_string_value='UNKNOWN', subset_cols=None)
classmethod
¶
Replace nulls in a dataframe.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
replace_on_nums |
bool
|
if it is to replace nulls on numeric columns. Applies to ints, longs and floats. |
True
|
default_num_value |
int
|
default integer value to use as replacement. |
-999
|
replace_on_strings |
bool
|
if it is to replace nulls on string columns. |
True
|
default_string_value |
str
|
default string value to use as replacement. |
'UNKNOWN'
|
subset_cols |
List[str]
|
list of columns in which to replace nulls. If not provided, all nulls in all columns will be replaced as specified. |
None
|
Returns:
Type | Description |
---|---|
Callable
|
A function to be called in .transform() spark function. |