-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Error ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandasMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Description
I want to use where
to set values across a DataFrame where a Series meets a condition.
For example:
df=pd.DataFrame({'a':[1,2,3], 'b':[4,5,6]})
But this
df.where(df['a']==2,0)
returns an unedited DataFrame.
Whereas this returns just the middle row, as you'd expect:
df[df['a']==2]
Supplying axis=0
or axis=1
doesn't help. Am I doing something wrong? Or this unintended behavior?
Versions
python: 2.7.6.final.0
pandas: 0.14.1
Metadata
Metadata
Assignees
Labels
Error ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandasMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate