I have a dataset with a column of names. I would like to drop rows with the lesser "P" value, if there exists one with a higher value. For example, in the dataset below, I would like to drop the row ID's 3 and 5 since there exists a 'Texas P5' and a 'North Dakota P9.' What is the best way to do this? Thanks in advance!
| ID | Name | Score |
|---|---|---|
| 1 | Minnesota P2 | 342 |
| 2 | Vermont P7 | 342 |
| 3 | Texas P4 | 65 |
| 4 | New Mexico | 643 |
| 5 | North Dakota P8 | 78 |
| 6 | North Dakota P9 | 245 |
| 7 | Texas P5 | 856 |
| 8 | Minnesota LP | 342 |