If I have a dataframe like below:
| Column A | Column B | Column C | Column D | Column E |
|:-----------|:---------- |:-----------|:-----------|:-----------|
| 1 | 7 | 1 | 13 | 13 |
| 2 | 8 | 2 | 14 | 13 |
| 3 | 9 | 3 | 15 | 13 |
| 4 | 10 | 4 | 16 | 13 |
| NA | 11 | NA | 17 | 13 |
| 6 | 12 | 6 | 1 | 13 |
I'd like to remove the duplicate columns A (or C), ignoring the fact that Column E has duplicate rows, and ignoring the column headers.
You can transpose and then transpose back:
df.T.drop_duplicates().T
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With