pandas.DataFrame.mask — pandas 0.25.3 documentation (original) (raw)

cond : boolean Series/DataFrame, array-like, or callable

Where cond is False, keep the original value. Where True, replace with corresponding value from other. If cond is callable, it is computed on the Series/DataFrame and should return boolean Series/DataFrame or array. The callable must not change input Series/DataFrame (though pandas doesn’t check it).

New in version 0.18.1: A callable can be used as cond.

other : scalar, Series/DataFrame, or callable

Entries where cond is True are replaced with corresponding value from other. If other is callable, it is computed on the Series/DataFrame and should return scalar or Series/DataFrame. The callable must not change input Series/DataFrame (though pandas doesn’t check it).

New in version 0.18.1: A callable can be used as other.

inplace : bool, default False

Whether to perform the operation in place on the data.

axis : int, default None

Alignment axis if needed.

level : int, default None

Alignment level if needed.

errors : str, {‘raise’, ‘ignore’}, default ‘raise’

Note that currently this parameter won’t affect the results and will always coerce to a suitable dtype.

try_cast : bool, default False

Try to cast the result back to the input type (if possible).