Load a pickled, .npy, or .npz binary file.
Parameters : | file : file-like object or string
mmap_mode: {None, ‘r+’, ‘r’, ‘w+’, ‘c’}, optional :
|
---|---|
Returns : | result : array, tuple, dict, etc.
|
Raises : | IOError :
|
Notes
Examples
Store data to disk, and load it again:
>>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]]))
>>> np.load('/tmp/123.npy')
array([[1, 2, 3],
[4, 5, 6]])
Mem-map the stored array, and then access the second row directly from disk:
>>> X = np.load('/tmp/123.npy', mmap_mode='r')
>>> X[1, :]
memmap([4, 5, 6])