December 2017
Intermediate to advanced
386 pages
10h 42m
English
Independent of which function was used to generate a file containing NumPy arrays in NPY format, the load() function is used to retrieve the data from disk. In the following examples, we assume that the files array_x.npy, arrays_xyz.npz, and arrays_xyz_c.npz were generated, as in the previous examples.
The single array contained in the array_x.npy file can be loaded with the following command:
x = np.load('array_x.npy')
This will open the file, read the array into the variable x, and close the file.
Loading arrays saved with savez() and savez_compressed() is slightly more complicated. The following code shows how to load the arrays stored in the arrays_xyz.npz file:
arrays = np.load('arrays_xyz.npz') ...Read now
Unlock full access