ak.repartition

Defined in awkward.operations.structure on line 3560.

ak.repartition(array, lengths, highlevel=True, behavior=None)
Parameters
  • array – A possibly-partitioned array.

  • lengths (None, int, or iterable of int) – If None, concatenate the pieces of a partitioned array into a non-partitioned array. If an integer, split or repartition into partitions of the given number of entries (except the last, if the length of the array doesn’t fit an integer number of equal-sized chunks). If an iterable of integers, split or repartition into the given sequence of lengths.

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

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

Returns a possibly-partitioned array: unpartitioned if lengths is None; partitioned otherwise.

Partitioning is an internal aspect of an array: it should behave identically to a non-partitioned array, but possibly with different performance characteristics.

Arrays can only be partitioned in the first dimension; it is intended for performing calculations in memory-sized chunks.