Answers for "can I use if statements inside a lambda function python"

6

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')
Posted by: Guest on January-21-2021

Code answers related to "can I use if statements inside a lambda function python"

Python Answers by Framework

Browse Popular Code Answers by Language