I have a dataframe. I want to replace values of all columns of some rows to a default value. Is there a way to do this via pandas apply function
NumPy based method would be to use np.in1d to get such a mask and use it like so -
mask = np.in1d(temp.c,mylist)
temp.ix[mask,temp.columns!='c'] = 0
This will replace in all columns except 'c'. If you are looking to replace in specific columns, say 'a' and 'b', edit the last line to -
temp.ix[mask,['a','b']] = 0