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

refactor: propagate attrs & behavior with dict-like ak.Array input data #3374

Merged
merged 2 commits into from
Jan 20, 2025

Conversation

pfackeldey
Copy link
Collaborator

Currently ak.Array (with dict input data) and ak.zip differ in the following ways:

  1. ak.zip does broadcasting, ak.Array does not (it errors instead)
  2. ak.zip does propagate attrs and behavior from all (nested) arrays in the given dictionary, ak.Array does not

For 1. this PR improves the error message for ak.Array if it encounters different length inputs to give a hint to try ak.zip instead (if broadcasting is a suitable solution).

The second difference does not exist anymore with this PR, ak.Array will now also propagate attrs and behavior in the same way ak.zip does. I think it is a bit unintuitive that ak.zip and ak.Array currently behave different for propagating attrs and behavior.

I'll add a policy label, because it might be good to hear some input/feedback from @ianna, @jpivarski and @agoose77 about this change.

(Closes: #3346)

Copy link
Collaborator

@ianna ianna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think, a test would be nice to have along with these changes :-)

src/awkward/highlevel.py Show resolved Hide resolved
Copy link
Collaborator

@ianna ianna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pfackeldey - Thanks! please, merge it.

@ianna ianna merged commit f06dad9 into main Jan 20, 2025
39 checks passed
@ianna ianna deleted the pfackeldey/policy_akArray_dict_inputdata branch January 20, 2025 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
policy Choice of behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Named axes in nested awkward arrays
2 participants