Change Series inplace in DataFrame after applying function on it
Use loc
:
wanted_data.loc[:, 'age'] = wanted_data.age.apply(lambda x: x + 1)
I would suggest
wanted_data['age']= wanted_data['age'].apply(lambda x: x+1)
,then save file as
wanted_data.to_csv(fname,index=False)
,
where "fname" is the name of a file to be updated.