Answers for "creating a pandas function with if else condition in it"

3

if condition dataframe python

df.loc[df['age1'] - df['age2'] > 0, 'diff'] = df['age1'] - df['age2']
Posted by: Guest on May-20-2020
5

pandas if else

df.loc[df['column name'] condition, 'new column name'] = 'value if condition is met'
Posted by: Guest on May-10-2020

Code answers related to "creating a pandas function with if else condition in it"

Python Answers by Framework

Browse Popular Code Answers by Language