I have a polygon shapefile on which I need to eliminate features belonging to the same group (identified by a variable/attribute XG) on the base of the values taken by another variable YA. In particular, given some features with same XG, I would like to keep the one with the highest YA value.
There are many groups for which XG identifies only one feature.
Below is a sample structure of my attribute table in case I did not explain my self well.
What I have:
XG YA 5 100 5 130 5 210 2 0.4 2 0.1 1 0.6
What I would like to get using Python console in QGIS:
XG YA 5 210 2 0.4 1 0.6