partition_list#
- caput.util.arraytools.partition_list(full_list: list, i: int, n: int, method: str = 'con') list[source]#
Partition a list into n pieces. Return the i th partition.
- Parameters:
- full_list
list The full list to partition.
- i
int The index of the partition to return.
- n
int The number of partitions to create.
- method{“con”, “alt”, “rand”}, optional
The method to use for partitioning. Options are:
“con”: contiguous partitions
“alt”: alternating partitions
“rand”: random partitions
Default is “con”.
- full_list
- Returns:
- partition
list The i th partition of the list.
- partition