pandas将DataFrame中的重复项挑出

a = df.drop_duplicates(subset=['微博id'],keep='first')
b = df.drop_duplicates(subset=['微博id'],keep=False)
f=a.append(b).drop_duplicates(subset=['微博id'],keep=False)

即将DataFrame中微博id这一series中的重复项挑出来了,f就是重复的

你可能感兴趣的:(pandas数据处理)