Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Numpy
## Creating the array of one's
a = np.ones((1,1))
## creating another array
b = np.arange(4)
## saving both the arrays in the same file using savez as .npz
savez('outfile1',a,b)
## Loading the saved .npz file
npzfile = np.load('outfile1.npz')
## Checking the files in the .npz file
print (npzfile.files)
#[Output]:
#['arr_1', 'arr_0']
## accessing the content of first file in.npz
print(npzfile['arr_0'])
#[Output]:
#[[1.]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.