-
Notifications
You must be signed in to change notification settings - Fork 126
Open
Labels
enhancementNew feature or requestNew feature or request
Description
numpy.load() feature upgrade
Hi,
Can you please add a very useful feature of using memmap to load only a part of numpy array from a file?
For example
- Let's create a memory-mapped array in write mode:
import numpy as np
nrows, ncols = 1000000, 100
f = np.memmap('memmapped.dat', dtype=np.float32,
mode='w+', shape=(nrows, ncols))
- Let's feed the array with random values, one column at a time because our system's memory is limited!
for i in range(ncols):
f[:, i] = np.random.rand(nrows)
x = f[:, -1]
del
### READING
f = np.memmap('memmapped.dat', dtype=np.float32,
shape=(nrows, ncols))
np.array_equal(f[:, -1], x)
True
del f
Additional context
(https://numpy.org/doc/stable/reference/generated/numpy.load.html)
like using numpy.memmap inside numpy.load()
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request