Examples

In [8]:
import numpy as np
import pandas as pd
In [13]:
s = pd.Series([2, 0, 5, 9, np.nan])

Boundary values are included by default:

In [17]:
s.between(1, 4)
Out[17]:
0     True
1    False
2    False
3    False
4    False
dtype: bool

With inclusive set to False boundary values are excluded:

In [18]:
s.between(1, 4, inclusive=False)
Out[18]:
0     True
1    False
2    False
3    False
4    False
dtype: bool

left and right can be any scalar value:

In [21]:
s = pd.Series(['Abhi', 'Boby', 'Jhonny', 'Rio'])
s.between('Anny', 'Danis')
Out[21]:
0    False
1     True
2    False
3    False
dtype: bool