Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def quality(total_bill, tip):
- if tip/total_bill > 0.25:
- return "Generous"
- else:
- return "Other"
- df['Quality'] = df[['total_bill', 'tip']].apply(lambda df: quality(df['total_bill'], df['tip']), axis = 1)
- # or
- df['Quality'] = np.vectorize(quality)(df['total_bill'], df['tip'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement