import pandas as pd
import numpy as np
aa = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
bb = [10, 21, 10, 21, 21, 10, 23, 23, 25, 25]
cc = [0, 1, 1, 2, 0, 0, 2, 2, 0, 0]
dd = [1, 2, 2, 4, 1, 6, 7, 8, 9, 10]
ee = [10, 21, 21, 21, 10, 10, 23, 23, 25, 25]
ff = [0, 1, 1, 2, 0, 0, 2, 2, 0, 0]
gg = [10, 21, 21, 21, 10, 10, 23, 23, 25, 25]
df_ = pd.DataFrame({'id': aa, 'source': bb, 'target': cc, 'x_source': dd, 'x_target': ee, 'y_source': ff, 'y_target': gg})
#
print(df_)
print(len(df_))
# 剔除重复的数据
# df_.drop_duplicates(subset=['x_source', 'x_target', 'y_source', 'y_target'], inplace=True)
# print(df_)
# print(len(df_))
# 获取除了第一次出现以外的重复行
df__ = df_[df_.duplicated(subset=['x_source', 'x_target', 'y_source', 'y_target'])]
print(df__)
print(len(df__))
11-04
4721

08-02
9277
