Examples
import numpy as np
import pandas as pd
s = pd.Series(range(6))
s.where(s > 0)
s.mask(s > 0)
s.where(s > 1, 10)
df = pd.DataFrame(np.arange(10).reshape(-1, 2), columns=['P', 'Q'])
df
m = df % 3 == 0
df.where(m, -df)
df.where(m, -df) == np.where(m, df, -df)
df.where(m, -df) == df.mask(~m, -df)