Dataset
df['sales']
abd | sales |
---|---|
atf | 1.2 |
adstys | 0.9 |
tyugug | 5.6 |
gfygv | 1.1 |
I want to create a new column based on sales values. If sales value is above 1.2 it should replace with 1 or 0 if anything less than 1.2
Applying list comprehension on a float column is throwing truth value error
df['new_sales_index']=df['sales'].apply(lambda x: [1 if y > 1.2 else 0])