Pe be
Pe be

Reputation: 43

cannot reshape array of size 64 into shape (28,28)

Not able to reshape the image in mnist dataset using sklean This is the starting portion of my code just load the data

some_digit  =   X[880] 
some_digit_image = some_digit.reshape(28,   28)

ERROR PART

ValueError                                Traceback (most recent call last)
<ipython-input-15-4d618bdb57bc> in <module>
      1 some_digit = X[880]
----> 2 some_digit_image = some_digit.reshape(28,28)

ValueError: cannot reshape array of size 64 into shape (28,28)

Upvotes: 1

Views: 6163

Answers (2)

function
function

Reputation: 1330

try:

some_digit  =   X[880] 
some_digit_image = some_digit.reshape(8,   8)

Upvotes: 0

alex83803
alex83803

Reputation: 102

You can only reshape it into a 8, 8 array. 8x8=64

Upvotes: 3

Related Questions