Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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')
Source by datatofish.com #
 
PREVIOUS NEXT
Tagged: #apply #lambda
ADD COMMENT
Topic
Name
1+5 =