bach.DataFrame.ffill

ffill

(sort_by=None, ascending=True, window=None)

[source]

Fill missing values by propagating the last 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 the sort_by must also be a list and len(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

DataFrame

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.