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

2019-08-20 22:21发布

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)

2条回答
贪生不怕死
2楼-- · 2019-08-20 22:38

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

查看更多
乱世女痞
3楼-- · 2019-08-20 22:44

try:

some_digit  =   X[880] 
some_digit_image = some_digit.reshape(8,   8)
查看更多
登录 后发表回答