I appear to be unable to update rows on a dataframe from inside an apply function
import pandas as pd
df = pd.DataFrame({'filename':['test0.dat', 'test2.dat'],
'm':[12, 13],
'n':[None, None]})
data = {'filename':'test2.dat', 'n':16}
def update_vals(row, data=data):
if row.filename == data['filename']:
row.n = data['n']
return row
df.apply(update_vals, axis=1)