1

I just wanted to ask if it was possible to store a numpy array as a .npy file and then use memmap to look through it at certain rows/columns?

ajl123
  • 887
  • 1
  • 14
  • 35
  • Not sure what you mean by .npy file. But yeah, you can store/hold an array as memmap and slice rows and columns out. The whole idea is to behave like a normal numpy-array without the need for all the memory. **But:** access patterns will matter! Slicing block-wise is good, while slicing small blocks / single values in high frequency is bad (in general). I would expect an outer ```np.random.shuffle()``` to be the worst kind of operation you can do. It will work, but you are slowed down by IO. – sascha Dec 13 '17 at 03:27
  • You can give the memmap file any extension you want, but I assume `.npy` means you want to memmap a filed stored by `numpy.save`?. I don't think this works (.npy files are machine independent, memmaps are certainly not). Haven't you just tried it? – kazemakase Dec 13 '17 at 07:34

0 Answers0