Removing duplicates according to two columns

Viewed 59

I have a dataset like that called final:

          pair     action      date
5978    ENJUSDT -13.178312  2021-07-26
5979    ETHUSDT  -1.432779  2021-07-26
5980    FTMUSDT   2.981864  2021-07-26
5981    HOTUSDT   4.680739  2021-07-26
5982    IOSTUSDT -2.843013  2021-07-26
5983    IOTAUSDT  4.394158  2021-07-26
5984    NEOUSDT   4.457547  2021-07-26
5985    ONEUSDT  -3.177746  2021-07-26
5986    QTUMUSDT  1.180195  2021-07-26
5987    THETAUSDT 4.784767  2021-07-26
5988    ENJUSDT  -2.562182  2021-07-26
5989    ETHUSDT   2.277357  2021-07-26
5990    FTMUSDT  -0.547493  2021-07-26

In the dataset there are duplicate values, that is value that have the same pair and date columns. So I used this to get rid of duplicates keeping the last row available for each duplicate, but the number of rows don't change, and duplicates do not disappear. Any suggestion?

final = final.drop_duplicates(subset=['date','pair'], keep='last')
0 Answers
Related