Probably a trivial problem, but I need to understand what's going on here (and how to fix it).
Suppose I have a dataframe with columns 'a' and 'b', as follows:
f = pandas.DataFrame({'a':[1,2,3,4,5], 'b':[10,20,30,40,50]})
Now for every element of 'a' that is 3 or less, I want to divide the corresponding elements of 'b' by 10.
f[f['a']<=3]['b'] = (f[f['a']<=3]['b'])/10
So that the values in column 'b' should now be [1,2,3,40,50].
But I find that column 'b' remains unchanged! What gives?