I\'ve got a multidimensional numpy array that I\'m trying to stick into a pandas data frame. I\'d like to flatten the array, and create a pandas index that reflects the pre-
Another possibility, although others maybe faster...
x,y,z = np.indices(A.shape) df = pd.DataFrame(np.array([p.flatten() for p in [x,y,z,A]]).T ,columns=['x','y','z',0])