bach.DataFrame.bfill
bfill
(sort_by=None, ascending=True, window=None)Fill missing values by using the next non-nullable value in each series.
Parameters
sort_by
(Optional[Union[str, Sequence[str]]]) – series label or sequence of labels used to sort values. Sorting of values is needed since result might be non-deterministic, as rows with NULLs might yield different results affecting the values to be propagated when using a filling method.ascending
(Union[bool, List[bool]]) – Whether to sort ascending (True) or descending (False). If this is a list, then thesort_by
must also be a list andlen(ascending) == len(sort_by)
.window
(Optional[Union[Window, DataFrame]]) – If provided, values are propagated within each partitioning group only, otherwise values are propagated in the entire DataFrame.
Returns
a new dataframe with filled missing values.
Return type
note
sort_by is required if DataFrame has no order_by.
danger
If sort_by is non-deterministic, this operation might yield different results after performing other operations over the resultant dataframe.