ak.str.uniques#

Defined in awkward.operations.str.akstr_uniques on line 87.

ak.str.uniques(array, *, highlevel=True, behavior=None, attrs=None)#
Parameters:
  • array – Array-like data (anything ak.to_layout recognizes).

  • 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.

Returns one copy of each distinct value in an array of strings or bytestrings, applying the operation independently at the final string-list axis and preserving outer nesting.

If array contains no string or bytestring data, this function returns it unchanged.

Requires the pyarrow library and calls pyarrow.compute.unique.

Traversal strategy:

ak.transform walks the Awkward layout tree and calls _action at each node. When _action finds a list whose content is a string or bytestring layout, it applies the Arrow kernel to slices defined by that list’s offsets and returns a replacement layout, which stops recursion into that subtree. Other nodes return None, allowing ak.transform to continue. This follows Awkward’s public traversal API and uses _apply_through_arrow for Arrow conversion rather than manually rebuilding the surrounding nesting with recursively_apply.