python - Turn a 1D array into nD array? -


this question has answer here:

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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -