ak.zip_no_broadcast#

Defined in awkward.operations.ak_zip_no_broadcast on line 20.

ak.zip_no_broadcast(arrays, *, parameters=None, with_name=None, highlevel=True, behavior=None, attrs=None)#
Parameters:
  • arrays (mapping or sequence of arrays) – Each value in this mapping or sequence can be any array-like data that ak.to_layout recognizes.

  • parameters (None or dict) – Parameters for the new ak.contents.RecordArray node that is created by this operation.

  • with_name (None or str) – Assigns a "__record__" name to the new ak.contents.RecordArray node that is created by this operation (overriding parameters, if necessary).

  • highlevel (bool) – If True, return an ak.Array; otherwise, return a low-level ak.contents.Content subclass.

  • behavior (None or dict) – Custom ak.behavior for the output array, if high-level.

  • attrs (None or dict) – Custom attributes for the output array, if high-level.

Combines arrays into a single structure as the fields of a collection of records or the slots of a collection of tuples.

Caution: unlike ak.zip this function will _not_ broadcast the arrays together. During typetracing, it assumes that the given arrays have already the same layouts and lengths.

This operation may be thought of as the opposite of projection in ak.Array.__getitem__, which extracts fields one at a time, or ak.unzip, which extracts them all in one call.

Consider the following arrays, one and two.

>>> one = ak.Array([[1.1, 2.2, 3.3], [], [4.4, 5.5], [6.6]])
>>> two = ak.Array([["a", "b", "c"], [], ["d", "e"], ["f"]])

Zipping them together using a dict creates a collection of records with the same nesting structure as one and two.

>>> ak.zip_no_broadcast({"x": one, "y": two}).show()
[[{x: 1.1, y: 'a'}, {x: 2.2, y: 'b'}, {x: 3.3, y: 'c'}],
 [],
 [{x: 4.4, y: 'd'}],
 []]

Doing so with a list creates tuples, whose fields are not named.

>>> ak.zip_no_broadcast([one, two]).show()
[[(1.1, 'a'), (2.2, 'b'), (3.3, 'c')],
 [],
 [(4.4, 'd')],
 []]

See also ak.zip and ak.unzip.