pandas.Series.interpolate

pandas 3.1.1 · Series and accessors · method

Estimate missing values from neighboring observations using a selected interpolation method.

Call syntax

Series.interpolate(…) Full signature
Series.interpolate(
    method='linear',
    *,
    axis=0,
    limit=None,
    inplace=False,
    limit_direction=None,
    limit_area=None,
    **kwargs,
)

Run the example

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

Parameters

ParameterRequirementAccepted values and behavior
method Optional
Positional or keyword
Default 'linear'
str

Choose the algorithm used to calculate, align, or fill the result.

axis Optional
Keyword only
Default 0
{0 or 'index', 1 or 'columns', None}

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

limit Optional
Keyword only
Default None
int

Set a maximum number of items affected by the operation.

inplace Optional
Keyword only
Default False
bool

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

limit_direction Optional
Keyword only
Default None
{'forward', 'backward', 'both'}

Choose whether to fill forward, backward, or in both directions where supported.

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

Restrict filling to gaps inside or outside valid observations.

**kwargs Optional
Additional keyword arguments

Returns

Series or DataFrame