-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Implement structure subset views #5994
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
Comments
Do you mean views into structured arrays that only contain some of the original fields? (like I was working on a PR for this off and on, which is partly done. The goal is to allow writeable multi-field views, and to rework a bunch of the field assignment code (which has strange/buggy edge cases) in I was going to sit on it until 1.10 is released to avoid cluttering the alpha/beta fixup process, but maybe that's not an issue. |
Returning nonwritable views of subsets of structured arrays was originally scheduled for 1.9 to be followed by writable views in 1.10. Clearly, we are behind schedule ;) I had a PR for the views implemented, but a corner case test broke as missing items were filled in with spaces in the new dtype. I suspect the problem isn't fatal even if not fixable, but haven't gotten around to revisiting it. |
Ah, yes, that's one of the corner cases I noticed too. There's a similar one where "unviewed" bytes get filled in with garbage. Here are demos of the one you mentioned, plus that one:
Other edge case:
Also, I don't like the current behavior that fields get assigned "by field name", and was hoping to be able to change it to assignment "by field position", if the back-compatibility break wasn't too bad (I suspect it might not be). That way assignment by structured scalars would behave the same as assignment using tuples (or equivalently, assignment using Probably a lot of my changes (which might turn out to be a bad idea in the end..) are othogonal to your PR for making the view writeable, so I'll keep thinking about them in the meantime. |
I am interested in starting contributing to NumPy and I would like to start with this issue. Are you people working on it? If not actively, I can take this part to let you people focus on other important things. |
Thoughts? Putting this in 1.11-release for the moment, but may move to 1.12. |
Let's just leave it for 1.12. That should branch in 3-4 months. |
This commit attempts to make structure assignment more consistent, and then changes multi-field indices to return a view instead of a copy. Assignment between structures now works "by field position" rather than "by field name". Fixes numpy#2353, fixes numpy#6085, fixes numpy#3351, fixes numpy#6085, fixes numpy#6314, fixes numpy#2346, fixes numpy#7058, fixes numpy#3641, fixes numpy#5994, fixes numpy#7262, fixes numpy#7493
This commit attempts to make structure assignment more consistent, and then changes multi-field indices to return a view instead of a copy. Assignment between structures now works "by field position" rather than "by field name". Fixes numpy#2353, fixes numpy#6085, fixes numpy#3351, fixes numpy#6085, fixes numpy#6314, fixes numpy#2346, fixes numpy#7058, fixes numpy#3641, fixes numpy#5994, fixes numpy#7262, fixes numpy#7493
Was scheduled for 1.9, but there was a potential problem with changes in filler. If done, can probably go straight to making them writable.
The text was updated successfully, but these errors were encountered: