I am trying to assign a value to column 'Percentage' based on multiple columns 'Class' and 'Value'
Below is a link that has my dataframe: https://filebin.net/fo2wk7crmwf0fycc
This is the logic that I want to be applied:
If df['Class'] equals 2 or 3, and if df['Value'] is less than 0.5, set df['Percentage'] to 0
If df['Class'] equals 2 or 3, and if df['Value'] is > 0.5 and <= 0.7, set df['Percentage'] to 0.25
If df['Class'] equals 2 or 3, and if df['Value'] is > 0.7 and <= 0.9, set df['Percentage'] to 0.5
Else set df['Percentage'] to 1
Below is an example of the output I am looking for:
Class | Value | Percentage |
---|---|---|
2 | 0.01 | 0 |
2 | 0.6 | 0.25 |
3 | 0.9 | 0.5 |
3 | 3 | 1 |
Thank you
Aucun commentaire:
Enregistrer un commentaire