question: calculate the tip percentage and print Generous
if tip >0.25 otherwise print not generous
if i am using lambda function its working fine that why not with a normal function call. i have attached the dataset i'm working with.
function:
def tip_cal(total_bill, tip):
if tip/total_bill > 0.25:
return "Generous"
else:
return "fair"
function call:
df[['total_bill', 'tip']].apply(tip_cal(df['total_bill'], df['tip']), axis=1)