6
在numpy中快速找到对称对
from itertools import product import pandas as pd df = pd.DataFrame.from_records(product(range(10), range(10))) df = df.sample(90) df.columns = "c1 c2".split() df = df.sort_values(df.columns.tolist()).reset_index(drop=True) # c1 c2 # 0 0 0 # 1 0 1 # 2 0 2 # 3 0 3 # 4 0 4 # .. .. .. # …