np.fill_diagonal(b, 0)
b
array([[0, 0, 0, 2, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 2], [0, 0, 0, 0, 0, 
    2, 1, 0], [2, 0, 0, 0, 1, 0, 0, 0], [1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 2,
    0, 0, 0, 1, 0], [0, 1, 1, 0, 0, 1, 0, 1], [0, 2, 0, 0, 0, 0, 1, 0]])
Get non-duplicate rows from numpy array