dataframe if statement code example
Example 1: pandas if else
df.loc[df['column name'] condition, 'new column name'] = 'value if condition is met'
Example 2: pandas if python
df['new column name'] = df['column name'].apply(lambda x: 'value if condition is met' if x condition else 'value if condition is not met')