Resizing memmap arrays
See original GitHub issueI’m referring to this discussion on stackoverflow. I’m trying to resize memmap arrays just as it works with ordinary arrays.
a = np.memmap('bla.bin', mode='w+', dtype=int, shape=10)
>>> memmap([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
a.resize(20, refcheck=False)
>>> ValueError: cannot resize this array: it does not own its data
I’m not sure about implications and side effects, but for me it looks like, if mmap
supports resizing, np.memmap
also should. I understand, that it might be hard to guarantee private access for a memmap. But if access can be excluded by the programmer, it should at least be possible to override any check by hand. And if resizing really shouldn’t be possible, at least the documentation could be clear about this point.
Issue Analytics
- State:
- Created 10 years ago
- Reactions:5
- Comments:21 (5 by maintainers)
Top Results From Across the Web
numpy.memmap.resize — NumPy v1.23 Manual
Change shape and size of array in-place. ... This reallocates space for the data area if necessary. Only contiguous arrays (data elements consecutive...
Read more >Resizing numpy.memmap arrays - python - Stack Overflow
Resizing the underlying mmap buffer works perfectly fine. The problem is how to reflect these changes to the array object.
Read more >numpy.memmap.resize
This reallocates space for the data area if necessary. Only contiguous arrays (data elements consecutive in memory) can be resized. The purpose of...
Read more >[Solved]-Resize numpy.memmap inplace-numpy
Coding example for the question Resize numpy.memmap inplace-numpy. ... Try passing memmap a file object you load in a with block: with open('A_r.npy', ......
Read more >class TempNumpyArrayFiles — Genome Contact Map Explorer
Update/resize all array files using given bigWig file ... array (numpy.memmap), where keys are chromosomes and values are respective numpy.memmap arrays.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any news about that stuff? It’s a while ago, but the issue remains, I guess.
I have the same problem. If this is not going to be addressed, perhaps the docs for http://docs.scipy.org/doc/numpy/reference/generated/numpy.memmap.resize.html should be amended? At the moment they strongly imply resizing
memmap
ed arrays is something numpy supports in a very straightforward way.