paddlets.transform.fill
- class Fill(cols: Union[str, List[str]], method: str = 'pre', value: int = 0, window_size: int = 10, min_num_non_missing_values: int = 1)[source]
Bases:
BaseTransformThis class is designed to fill missing values in columns. There are three kinds of ways to fulfill this task, including
Replace the missing values with a statistic computed from a sliding window, e.g. MAX, MIN, MEAN, or MEDIAN;
Replace the missing values with adjacent values, which could be values previous or next to the missing values;
Replace the missing values with the value specified by the user.
- Parameters
cols (str|List) – Column name(s) to be processed.
method (str) – Method of filling missing values. Totally 8 methods are supported currently: max: Use the max value in the sliding window. min: Use the min value in the sliding window. mean: Use the mean value in the sliding window. median: Use the median value in the sliding window. pre: Use the previous value. next: Use the next value. zero: Use 0s. default: Use the value specified by the user.
value (int||float) – Only effective when the method is default, value specified by the user to replace the missing values.
window_size (int) – Size of the sliding window.
min_num_non_missing_values (int) – Minimum number of non-missing values in the sliding window, if less than the min_num_non_missing_values, the statistic will be set to np.nan.
- Returns
None
- fit_one(dataset: TSDataset)[source]
- Parameters
dataset (TSDataset) – dataset to process
- Returns
self