Just an addition to @Andy Hayden's answer:
Since DataFrame.mask
is the opposite twin of DataFrame.where
, they have the exactly same signature but with opposite meaning:
DataFrame.where
is useful for Replacing values where the condition is False. DataFrame.mask
is used for Replacing values where the condition is True.So in this question, using df.mask(df.isna(), other=None, inplace=True)
might be more intuitive.