pandas.Series.between

pandas 3.1.1 · Series and accessors · method

Make a boolean mask for values inside an interval. Set inclusive to control which endpoints count.

Call syntax

Series.between(left, right, inclusive='both')

Run the example

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

Parameters

ParameterRequirementAccepted values and behavior
left Required
Positional or keyword
scalar or list-like

Supply the left-hand input or the left endpoint of the interval.

right Required
Positional or keyword
scalar or list-like

Supply the right-hand input or the right endpoint of the interval.

inclusive Optional
Positional or keyword
Default 'both'
{"both", "neither", "left", "right"}

Choose whether the start, end, both, or neither boundary is included.

Returns

Series