# replaces values with other where condition is False
DataFrame.where(cond, other=nan, inplace=False, axis=None, level=None, errors='raise', try_cast=False)
import pandas as pd
df = pd.DataFrame({'values':[1,2,3,4]})
df.where(df['values'] % 2 == 0, -1) # output : [-1, 2, -3, 4]