Skip to content

pd.Series.where

pandas.Series.where(cond, other=nan, inplace=False, axis=None, level=None, errors='raise', try_cast=NoDefault.no_default)

Supported Arguments

argument datatypes
cond
  • boolean array
  • 1d bool numpy array
other
  • 1d numpy array
  • scalar

Note

Series can contain categorical data if other is a scalar

Example Usage

>>> @bodo.jit
... def f(S):
...     return S.where((S % 3) != 0, 0)
>>> S = pd.Series(np.arange(100))
>>> f(S)
0      0
1      1
2      2
3      0
4      4
      ..
95    95
96     0
97    97
98    98
99     0
Length: 100, dtype: int64