I have a pandas dataframe that has combinations of two id columns such as this:
| ID1 | ID2 |
|---|---|
| A | B |
| A | C |
| A | D |
| A | E |
| B | C |
| B | D |
| B | E |
| C | D |
| C | E |
| D | E |
| F | H |
| I | K |
| K | J |
| G | F |
| G | H |
| I | J |
Here we have the choose 2 combinations for ABCD, FGH, IJK.
I would like to only keep the rows for the value with the most ID1's for a particular set. For ABCD this would be A, for FGH this would be G, and for IJK this would be I. Resulting in the following:
| ID1 | ID2 |
|---|---|
| A | B |
| A | C |
| A | D |
| A | E |
| I | K |
| G | F |
| G | H |
| I | J |
