Skip to content

ENH: Add option to append to existing .npy files to numpy.save#11939

Closed
kohlrabi wants to merge 1 commit intonumpy:mainfrom
kohlrabi:npy_append
Closed

ENH: Add option to append to existing .npy files to numpy.save#11939
kohlrabi wants to merge 1 commit intonumpy:mainfrom
kohlrabi:npy_append

Conversation

@kohlrabi
Copy link
Copy Markdown

@kohlrabi kohlrabi commented Sep 12, 2018

Since my workflow involves working with large memmapped .npy files, I was always a bit stumped that I was not able to append to .npy files, and was only able to save and work with arrays which fit into RAM.

This patch adds the option to append arrays to .npy files. I successfully ran the runtests.py test suite for both Python2.7 and Python3.6, and tested it with arrays of different shapes.

Further future improvements could be to add this option to numpy.savez as well.

@kohlrabi
Copy link
Copy Markdown
Author

Thinking about this, it might be more general and useful to implement a true Buffer-like (npyBuffer) object into which one can write incrementally, and use that for the append-business as well.

@charris
Copy link
Copy Markdown
Member

charris commented Sep 14, 2018

You need to write tests for the new functionality. Might also mention this on the mailing list for discussion.

@charris
Copy link
Copy Markdown
Member

charris commented Sep 14, 2018

Will also need release note if it goes in.

@charris charris added the 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes label Sep 14, 2018
@kohlrabi
Copy link
Copy Markdown
Author

Thanks for taking a look. Currently I have not much time to dive into how to create test cases. I'll have to do it at a later time.

@seberg
Copy link
Copy Markdown
Member

seberg commented Apr 28, 2023

Thanks for the PR, considering the age, I am going to close it. Note that gh-20321 modified our headers to make it easier to do this externally, and the PR also links a project that does so outside of NumPy.
Including in NumPy could be revived, but for the moment (considering the age), I will operate under the assumption that this is OK as an extension living outside of NumPy proper.

@seberg seberg closed this Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants