libb.backfill

backfill(values)

Back-fill a sorted array with the latest value.

Parameters:

values – List of values (may contain None).

Returns:

List with None values replaced by the most recent non-None value.

Examples

>>> backfill([None, None, 1, 2, 3, None, 4])
[1, 1, 1, 2, 3, 3, 4]