def FindAinB2(A, B):
    assert A.shape[1
        ] % 10 == 0, 'Number of columns in A is not a multiple of 10'
rng = np.arange(A.shape[1])
A.columns = pd.MultiIndex.from_product([list(range(A.shape[1] / 10)), list(range(10))])
return (A.stack(0) << np.arange(10)).sum(1).unstack()
Сравнение строк двух кадров данных pandas?