Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Nested .npz files #6514

Closed
wants to merge 2 commits into from
Closed

Conversation

rherault-pro
Copy link

In Short

This is a demo code for having nested NPZ files.

What ?

When a dict variable with only str keys is given to np.savez, it is not converted to array of dtype=object nor pickled but rather used to create a child npz file that will be embedded in the parent npz file.
Of course that can be recursive.

Why ?

  • Having structured data without the use of dtype object
  • If saving a tree structure made out of valid dicts with standard arrays as leaves, no need to use pickle (and so avoid python2/python3 unpickle problems)

Comments

The writing part (modification of function _savez + new function _is_valid_dict ) is quite clean.

The reading part (modification of class NpzFile) can gain in quality, but that would mean deeper changes int the way getitem handles field types and in the way the class handles its parent zip file: currently we can't pass a byte stream to the NpzFile constructor but only a real file, that induces the use of temp files when having nested npz files.

@rherault-pro
Copy link
Author

This pull request is not compatible with pull request #6540.
Nevertheless this proposal will be easier/cleaner to implement after pull request #6540.

@charris charris changed the title Nested .npz files ENH: Nested .npz files Oct 24, 2015
@homu
Copy link
Contributor

homu commented Feb 9, 2016

☔ The latest upstream changes (presumably #7133) made this pull request unmergeable. Please resolve the merge conflicts.

Base automatically changed from master to main March 4, 2021 02:03
@InessaPawson InessaPawson added 52 - Inactive Pending author response triage review Issue/PR to be discussed at the next triage meeting labels Jun 8, 2022
@mattip mattip removed the triage review Issue/PR to be discussed at the next triage meeting label Jun 15, 2022
@mattip
Copy link
Member

mattip commented Jun 15, 2022

This has not been updated nor generated comments in quite a while. I will close it, but if there is interest in pursuing this please reopen or open a new PR.

@mattip mattip closed this Jun 15, 2022
@mattip
Copy link
Member

mattip commented Jun 15, 2022

@rkern just making sure you saw that we closed this.

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.

None yet

5 participants