python - Turn a 1D array into nD array? -
this question has answer here:
- convert 1d array 2d array in numpy 3 answers
i have 784 element 1-dimensional array flattened 28x28 image.
is there nice, snappy, numpy/scipy procedure translating 784 element array 28x28 array?
or have do:
for in range(0,28): j in range(0,28): my_image[i,j] = oned_vector[28*i + j]
reshape() works:
a = np.arange(784) a.reshape(28, 28)
Comments
Post a Comment