I have a 2-d numpy array that I would like to shuffle. Is the best way to reshape it to 1-d, shuffle and reshape again to 2-d or is it possible to shuffle without reshaping?
You could shuffle a.flat:
a.flat
>>> np.random.shuffle(a.flat) >>> a array([[6, 1, 2], [3, 5, 0], [7, 8, 4]])