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