I have a dataframe df
import pandas
df = pandas.DataFrame(data=[[1,True],[2,False]],columns=['A','decide'])
to which rows I want to apply a function fun depending on the value of the decide column
def fun(case,var):
case = case + var
return case
df=df.apply(lambda x: fun(x,1) if x['decide'] else fun(x,2))
of course doesn't work :) any idea why and how to make it working?