I have the following dataframe
Name Rank1 Rank2 Rank3 Rank4 Rank5
Name1 Title1 Title3 Title7 Title2 Title6
Name2 Title3 Title2 Title6 Title5 Title4
Name3 Title2 Title5 Title3 Title6 Title4
Name4 Title4 Title6 Title1 Title5 Title2
and I would like to make the dataframe look like this
Name Title1 Title2 Title3 Title4 Title5 Title6 Title7
Name1 1 4 2 10 10 5 3
Name2 10 2 1 4 4 3 10
Name3 10 1 3 5 2 4 10
Name4 3 5 10 1 4 2 10
Any advice on how to do this?
Use the following code.
This code finds the value and returns its index for each row.
If there is no value in a row, then it returns 10.