Pandas · Method
df.where
DataFrame.where keeps values where a condition is true and replaces other values. You can provide a scalar, aligned data, or callable as the replacement.
Last updated
Syntax
DataFrame.where(cond, other=<no_default>, *, inplace=False, axis=None, level=None)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
DataFrame.mask()Series.mask()