df.head()
>>>
Price Seqno Symbol time
0 1623.0 0.0 APPL 1473411962
1 1623.0 0.0 APPL 1473411962
2 1623.0 0.0 APPL 1473411963
3 1623.0 0.0 APPL 1473411963
4 1649.0 1.0 APPL 1473411963
df.drop_duplicates(["Seqno"],keep="last").head()
>>>
Price Seqno Symbol time
3 1623.0 0.0 APPL 1473411963
7 1649.0 1.0 APPL 1473411964
11 1642.0 2.0 APPL 1473411965
15 1636.0 3.0 APPL 1473411966
19 1669.0 4.0 APPL 1473411967
df.drop_duplicates(subset=None, keep='first', inplace=False)
1 data.drop_duplicates()#data中一行元素全部相同时才去除
2 data.drop_duplicates(['a','b'])#data根据’a','b'组合列删除重复项,默认保留第一个出现的值组合。传入参数keep='last'则保留最后一个