1df['equal_or_lower_than_4?'] = df['set_of_numbers'].apply(lambda x: 'True' if x <= 4 else 'False')
2
1
2from pandas import DataFrame
3
4names = {'First_name': ['Hanah', 'Ria', 'Jay', 'Bholu', 'Sachin']}
5df = DataFrame(names, columns =['First_name'])
6
7df['Status'] = df['First_name'].apply(lambda x: 'Found' if x == 'Ria' else 'Not Found')
8
9print (df)
1df.loc[df['column name'] condition, 'new column name'] = 'value if condition is met'
2
1df.loc[df[‘column name’] condition, ‘new column name’] = ‘value if condition is met’