pandas.Series.bfill

pandas 3.1.1 · Series and accessors · method

Fill a gap using the next available value along the selected direction.

Call syntax

Series.bfill(*, axis=None, inplace=False, limit=None, limit_area=None)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
axis Optional
Keyword only
Default None
{0 or 'index'} for Series, {0 or 'index', 1 or 'columns'} for DataFrame

Choose which axis the operation acts on. The accepted axis labels depend on the receiver.

inplace Optional
Keyword only
Default False
bool

Choose whether to change the existing object. Where supported, an in-place call typically returns None.

limit Optional
Keyword only
Default None
int

Set a maximum number of items affected by the operation.

limit_area Optional
Keyword only
Default None
{None, 'inside', 'outside'}

Restrict filling to gaps inside or outside valid observations.

Returns

Series/DataFrame