0

If I have a data frame like this:

    id        descrip   
0   0000      x         
1   0000      y
2   0000      z  
3   1111      x        
4   1111      z        
5   2222      z         
6   3333      x         
7   3333      y

And I want to basically keep rows based on a priority of the descrip column, where if there is a z, then that is preferred over a y, which is preferred over an x.

So I basically want this:

    id        descrip   
0   0000      z        
1   1111      z        
2   2222      z                
3   3333      y  

Not sure how I would approach this

Anonymous Asked question May 14, 2021