I have 2 columns, called decision1 and decision2.
I want to compare them in order to get the highest occurrence between the 2, so I either get the highest occurrence in decision1 or decision2, according to the greatest one. So far my attempts led to this, but with no success since I just get the highest occurrence in EACH column and not combined
# weightage option
if args['weightage'] == "yes":
attr1 = data['decision'].value_counts().idxmax #highest occurrence in decision
attr2 = data['decision2'].value_counts().idxmax #highest occurrence in decision2
heaviest_attribute = data.groupby(['decision','decision2']).size()
Ideally I would just need to use some kind of max()
function between attr1
and attr2
but I don't know how to handle this.
For example, given this table
I want to compare decision1 and decision2 columns as if they were one column, and the expected output, in this case, would be 'Yes', because it's the most recurrent value.