Closed
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