pandas dataframe get value condition code example
Example: if condition dataframe python
df.loc[df['age1'] - df['age2'] > 0, 'diff'] = df['age1'] - df['age2']
df.loc[df['age1'] - df['age2'] > 0, 'diff'] = df['age1'] - df['age2']