pandas.Series.clip

pandas 3.1.1 · Series and accessors · method

Clamp values to lower or upper limits, leaving values within the limits unchanged.

Call syntax

Series.clip(lower=None, upper=None, *, axis=None, inplace=False, **kwargs)

Run the example

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

Parameters

ParameterRequirementAccepted values and behavior
lower Optional
Positional or keyword
Default None
float or array-like
upper Optional
Positional or keyword
Default None
float or array-like
axis Optional
Keyword only
Default None
{0 or 'index', 1 or 'columns', None}

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.

**kwargs Optional
Additional keyword arguments

Returns

Series or DataFrame