pandas.DataFrame.where

Replace values where the condition is False.

param cond
boolean Series/DataFrame, 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 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.

param other
scalar, Series/DataFrame, or callable

Entries where cond is False 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.

param inplace
bool, default False

Whether to perform the operation in place on the data.

param axis
int, default None

Alignment axis if needed.

param level
int, default None

Alignment level if needed.

param 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.

param try_cast
bool, default False

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

return

Same type as caller

Warning

This feature is currently unsupported by Intel Scalable Dataframe Compiler