zcollection.partitioning.abc.Partitioning#

class zcollection.partitioning.abc.Partitioning(variables, dtype=None)[source]#

Bases: object

Initializes a new Partitioning instance.

Parameters:
  • variables (Sequence[str]) – A list of strings representing the variables to be used for partitioning.

  • dtype (Sequence[str] | None) – An optional sequence of strings representing the data type used to store variable values in a binary representation without data loss. Must be one of the following allowed data types: int8, int16, int32, int64, uint8, uint16, uint32, uint64. If not provided, defaults to int64 for all variables.

Raises:
  • TypeError – If dtype is not a sequence of strings.

  • ValueError – If any of the data types provided is not one of the allowed data types.

Attributes

variables

Variables to be used for the partitioning.

ID

The ID of the partitioning scheme

Public Methods

decode(values)

Decode a partitioning scheme.

dtype()

Return the data type of the partitioning scheme.

encode(partition)

Encode a partitioning scheme to the handled values.

from_config(config)

Create a partitioning scheme from a configuration.

get_config()

Return the configuration of the partitioning scheme.

index_dataset(zds)

Yield the indexing scheme for the given dataset.

join(partition_scheme, sep)

Join a partitioning scheme.

list_partitions(fs, path)

List the partitions.

parse(partition)

Parse a partitioning scheme.

split_dataset(zds, axis)

Split the dataset into partitions.

Protected Methods

_abc_impl

_dtype

Data type used to store variable values in a binary representation without data loss.

_keys()

Return the different keys of a partition.

_partition(selection)

Format the partitioning scheme.

_pattern

The regular expression that matches the partitioning scheme.

_regex()

Return a regular expression that matches the partitioning scheme.

_split(variables)

Split the variables constituting the partitioning into partitioning schemes.

Special Methods

__len__()

Return the number of partitions.