lambda functions inside if statement code example
Example 1: apply lambda with if
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')
Example 2: if condition in python lambda
func = lambda element: (expression and DoSomething) or DoSomethingIfExpressionIsFalse