I am trying to put 0 or 1 in place of the null rows of a column using lambda function, but my code doesn't make any changes in the data.
df[df['a'].isnull()]['a']=df[df['a'].isnull()].apply(lambda x:1 if (x.b==0 and x.c==0) else
0,axis=1)
Where I am wrong in this?? sample table
df[df['a'].isnull()]makes a copydf[df['a'].isnull()]['a']accesses the column in that copy. Then the copy gets thrown away since there are no references to it any longer How to deal with SettingWithCopyWarning in Pandas usedf.loc[df['a'].isnull(), 'a'] = ...as outlined in the accepted answer