I am reading a CSV file and need to change the values of one of the attributes according to the count of these values. The values are typically in the range of whole numbers 1 - 6 (might be more) with various total counts. I need to change these values so the most frequent gets a value of 1, the second gets 2, third gets 3 and the rest is deleted.
In the example below: 6 is changed to 1, 4 is changed to 2, 1 to 3 and 2 is deleted.
If the counts of any values are equal I should get an error.
Attribute name
6
6
6
6
4
4
4
1
1
2
Thank you for your help.