# if list does not have duplicate values
if majority != 0 and (len(list_maj) == len(set(list_maj))):
if counter_a == majority:
row['new_label'] = 'a'
if counter_b == majority:
row['new_label'] = 'b'
if counter_c == majority:
row['new_label'] = 'c'
if counter_d == majority:
row['new_label'] = 'd'
if counter_e == majority:
row['new_label'] = 'e'
# if list has duplicate values. If there are 2 elements with same maximum value, take both
if majority != 0 and (len(list_maj) != len(set(list_maj))):
if counter_a == majority and list_maj.count(majority) == 1:
row['new_label'] = 'a'
elif counter_a == majority and counter_a == counter_b:
row['new_label'] = 'a, b'
elif counter_a == majority and counter_a == counter_c:
row['new_label'] = 'a, c'
elif counter_a == majority and counter_a == counter_d:
row['new_label'] = 'a,d'
elif counter_a == majority and counter_a == counter_e:
row['new_label'] = ‘a,e’
elif counter_b == majority and list_maj.count(majority) == 1:
row['new_label'] = 'b'
elif counter_b == majority and counter_b == counter_a:
row['new_label'] = 'a,b'
elif counter_b == majority and counter_b == counter_c:
row['new_label'] = 'b,c'
elif counter_b == majority and counter_b == counter_d:
row['new_label'] = 'b,d'
elif counter_b == majority and counter_b== counter_e:
row['new_label'] = 'b,e'
elif counter_c == majority and list_maj.count(majority) == 1:
row['new_label'] = 'c’
elif counter_c == majority and counter_c == counter_a:
row['new_label'] = 'a, c'
elif counter_c == majority and counter_c == counter_b:
row['new_label'] = 'b, c'
elif counter_c == majority and counter_c == counter_d:
row['new_label'] = 'd, c'
elif counter_c == majority and counter_c == counter_e:
row['new_label'] = 'e, c'
elif counter_d == majority and list_maj.count(majority) == 1:
row['new_label'] = 'd'
elif counter_d == majority and counter_d == counter_a:
row['new_label'] = 'd, a'
elif counter_d == majority and counter_d == counter_b:
row['new_label'] = 'd, b'
elif counter_d == majority and counter_d == counter_c:
row['new_label'] = 'd, c'
elif counter_d == majority and counter_d == counter_e:
row['new_label'] = 'd, e' elif counter_e == majority and list_maj.count(majority) == 1:
row['new_label'] = 'e'
elif counter_e == majority and counter_e == counter_a:
row['new_label'] = 'e, a'
elif counter_e == majority and counter_e == counter_b:
row['new_label'] = 'e, b'
elif counter_e == majority and counter_e == counter_c:
row['new_label'] = 'e, c'
elif counter_e == majority and counter_e == counter_d:
row['new_label'] = 'e, d'
else:
row['new_label'] = 'no_label'
else:
row['new_label'] = 'no_label'