I have DataFrame in Python like below where we can see duplicates for some ID:
| ID | COL1 | COL2 | COL3 |
|---|---|---|---|
| 123 | XX | 111 | ENG |
| 123 | abc | 111 | ENG |
| 444 | ccc | 2 | o |
| 444 | ccc | 2 | o |
| 67 | a | 89 | xx |
And I need to select rows where is situation like for ID = 123, where rows are duplicated but in some column / columns we have different value, so as an output I need something like below:
| ID | COL1 | COL2 | COL3 |
|---|---|---|---|
| 123 | XX | 111 | ENG |
| 123 | abc | 111 | ENG |
How can I do that in Python Pandas? I can add that in my real dataset I have many many more columns so I need to create solution whoch will be good for more columns not only ID,COL1,COL2,COL3 :)