- #1
msn009
- 53
- 6
the code below intends to take the maximum value that is calculated for each of the variable but after the max value is obtained I am not sure how to ensure there are no 2 or more values are the same in the if else loop as if 'a' has the max value of 3 and 'b' also has the max value of 3 then the if loop spits out 'a' but i want it to go to the else loop if there are equal values.
Code:
majority = max( a, b, c, d)
if majority != 0:
if a == majority:
df['label'] = 'aaaaaa'
elif b== majority:
df['label'] = 'bbbbbb'
elif c == majority:
df['label'] = 'cccccc'
elif d== majority:
df['label'] = 'ddddd'
else:
row['label'] = 'no_label'