pandas.DataFrame.where — pandas 0.24.0rc1 documentation (original) (raw)
cond : boolean NDFrame, array-like, or callable
Where cond is True, keep the original value. Where False, replace with corresponding value from other. If cond is callable, it is computed on the NDFrame and should return boolean NDFrame or array. The callable must not change input NDFrame (though pandas doesn’t check it).
New in version 0.18.1: A callable can be used as cond.
other : scalar, NDFrame, or callable
Entries where cond is False are replaced with corresponding value from other. If other is callable, it is computed on the NDFrame and should return scalar or NDFrame. The callable must not change input NDFrame (though pandas doesn’t check it).
New in version 0.18.1: A callable can be used as other.
inplace : boolean, 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.
- raise : allow exceptions to be raised.
- ignore : suppress exceptions. On error return original object.
try_cast : boolean, default False
Try to cast the result back to the input type (if possible).
raise_on_error : boolean, default True
Whether to raise on invalid data types (e.g. trying to where on strings).
Deprecated since version 0.21.0: Use errors.