jeudi 15 août 2019

Conditional Statements for dataframes

I have a dataframe, shown below. Dataframe start

I want to look at the columns D,F,M,P and return a Result column the value that appears the most in each row.

The rules I want to make sure this statement follows are: 1) if there is a split between the rows containing 2 IG's and 2 HY's, return HY in the Result column.
2) if a column contains a NaN value, ignore it and use the other values available.

I want the resulting dataframe to look like: Result_DF

Aucun commentaire:

Enregistrer un commentaire