Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you open .NPY files?

Tags:

python

numpy

How do I open .NPY files in python so that I can read them? I've been trying to run some code I've found but it outputs in .NPY files so I can't tell if its working.

like image 532
Jeremy.T.Clement Avatar asked Feb 20 '26 05:02

Jeremy.T.Clement


1 Answers

*.npy files are binary files to store numpy arrays. They are created with

import numpy as np

data = np.random.normal(0, 1, 100)
np.save('data.npy', data)

And read in like

import numpy as np
data = np.load('data.npy')
like image 53
Carl Smestad Avatar answered Feb 21 '26 18:02

Carl Smestad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!