lundi 19 août 2019

Creating a new column based off contents of others columns

I have a dataframe, shown here.

Starting Dataframe

I want to create a new column called 'Result'.

Result should be created based off the following rules. 1) Return the value that is shown the most based off columns D,F,M,P. 2) If there is a tie between IG and HY, return HY. 3) Do not count NaN as a value.

My resulting dataframe would like this: Result Dataframe

Aucun commentaire:

Enregistrer un commentaire