def permute_columns(x):
    ix_i = np.random.sample(x.shape).argsort(axis=0)
ix_j = np.tile(np.arange(x.shape[1]), (x.shape[0], 1))
return x[ix_i, ix_j]
Best way to permute contents of each column in numpy