ipython-books / cookbook-code

[DEPRECATED] See the new edition:
http://ipython-books.github.io/
Other
972 stars 457 forks source link

np.memap won't work without mode parameter if the file does not exist yet (receipe 4.9) #3

Closed rndblnch closed 10 years ago

rndblnch commented 10 years ago

the memory mapping exemple will only work if the file already exists. to make it work regardless of that, it should have the mode parameter filled:

f = np.memmap('memmapped.dat', dtype=np.float32, mode='w+', shape=(nrows, ncols))

https://github.com/ipython-books/cookbook-code/blob/master/notebooks/chapter04_optimization/09_memmap.ipynb#L61

rossant commented 10 years ago

Thanks! PR welcome :)