Examples
import numpy as np import pandas as pd
s = pd.Series(range(6)) s.where(s > 0)
0 NaN 1 1.0 2 2.0 3 3.0 4 4.0 5 5.0 dtype: float64
s.mask(s > 0)
0 0.0 1 NaN 2 NaN 3 NaN 4 NaN 5 NaN dtype: float64