Skip to content

Instantly share code, notes, and snippets.

@Robofied
Created February 15, 2019 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Robofied/3a7ebebc20b72fa0b41bdec045bb52bd to your computer and use it in GitHub Desktop.
Save Robofied/3a7ebebc20b72fa0b41bdec045bb52bd to your computer and use it in GitHub Desktop.
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