I have read the docs of DataFrame.apply
DataFrame.apply(func, axis=0, broadcast=False, raw=False, reduce=None, args=(), **kwds)¶ Applies function along
The answer is,
df['A'] = df['A'].map(addOne)
and maybe you would be better to know about the difference of map, applymap, apply.
map
applymap
apply
but if you insist to use apply, you could try like below.
def addOne(v): v['A'] += 1 return v df.apply(addOne, axis=1)