I have got a dataframe and I would like to remove some duplicate rows by taking the ones with max values.
Here an example simplified of my dataframe:
    Code   Weight  Year
1   27009  289     1975
2   27009  300     1975
3   27009  376     1977
4   30010  259     1975
5   30010  501     1979
6   30010  398     1979
[....]
My output should be:
    Code   Weight  Year
1   27009  300     1975
2   27009  376     1977
3   30010  259     1975
4   30010  501     1979
[....]
Between Code and Weight I have got 5 more columns with different values and between Weight and Year one more column with still different values.
Should I use an if statement?
 
     
    