ONION
ONION

Reputation: 269

Python to Open .npy File

Nowadays i study machine learning using Python and Numpy.

After installing Keras, i started to see this thing.

then i found mnist.npz file. (mnist.npz is basic handwriting example for study machine learning)

I was curious about mnist.npz. so i try to open it.

i have coded this


import numpy as np

x = np.load("C:/mnist.npz")
print (x)

(the npz file is in drive C)

then computer show this


<numpy.lib.npyio.NpzFile object at 0x000001F1BE7E6A58>

??????????????what?????????

What does computer mean by this?

so i tried the other way. i have coded this


import numpy as np

x = np.load("C:/mnist.npz")
print(x['y_test'])

so computer show this.


[7 2 1 ... 4 5 6]

why show [...]?!?!?!?!?!?!? Why do not computer show me all array? Show me all!

example... computer can show me [7 2 1 1 2 3 4 4 5 6]!!

But the computer does not. computer does not show it all.

I want to see all elements of an array.

how to see all elements in .npz and .npy files???????

Google has no answer.

Upvotes: 1

Views: 3244

Answers (1)

user239457
user239457

Reputation: 1886

Set the printing options for numpy

np.set_printoptions(threshold=np.inf)

Upvotes: 1

Related Questions