-
Notifications
You must be signed in to change notification settings - Fork 87
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
zip #77
Comments
Note: it's not just tuples. >>> awkward.JaggedArray.zip({"x": first, "y": second}).tolist()
[[{'x': 1, 'y': 1.1}, {'x': 2, 'y': 2.2}, {'x': 3, 'y': 3.3}],
[],
[{'x': 4, 'y': 4.4}, {'x': 5, 'y': 5.5}]] |
The
|
I had intended to create a PR for this, but accidentally committed to master (too distracted). So instead of linking to a PR, here's the one commit that finished it: 3800552 |
The test passed, so I'm closing this. |
This is an operation that combines a list (
std::vector
) of arrays (std::shared_ptr<Content>
) into aRecordArray
if any member of that list is one-dimensional, and aListArray
orRegularArray
ofRecordArray
for each dimension that all arrays share.It existed in old Awkward, though the implementation will be easier now. Here's what that looked like:
Those 2-tuples are a
RecordArray
in which the first field is fromfirst
and the second field is fromsecond
. Sincefirst
andsecond
are both ListType with the same subarray lists for each element, the output is a ListType of RecordType (e.g.ListOffsetArray
ofRecordArray
), in which the sharedoffsets
are used in the singleListOffsetArray
that wraps theRecordArray
.Perhaps this was too implicit in the past—perhaps there should be a
zipdepth
parameter that explicitly controls how many levels of list nesting to expect to be identical for all arguments (throwing an error if they're not).zip
is the way to make particle records from CMS NanoAOD, for instance. (It's useful.)The text was updated successfully, but these errors were encountered: