meerkat.mixins package

Submodules

meerkat.mixins.blockable module

class BlockableMixin(*args, **kwargs)[source]

Bases: object

classmethod is_blockable()[source]
block_class: type = None

meerkat.mixins.cloneable module

class CloneableMixin(*args, **kwargs)[source]

Bases: object

copy(**kwargs) object[source]
view() object[source]
class StateClass(klass: type, state: object)[source]

Bases: object

An internal class to store the state of an object alongside its associated class.

klass: type
state: object

meerkat.mixins.collate module

class CollateMixin(collate_fn: Optional[Callable] = None, *args, **kwargs)[source]

Bases: object

collate(*args, **kwargs)[source]

Collate data.

property collate_fn

Method used to collate.

identity_collate(batch: List)[source]

meerkat.mixins.file module

class FileMixin(filepath: Union[str, Path], *args, **kwargs)[source]

Bases: object

Mixin for adding in single filepath.

class PathsMixin(paths: Union[str, Path, PathLike, Sequence[Union[str, Path, PathLike]]], *args, **kwargs)[source]

Bases: object

Mixin for adding in generic paths.

meerkat.mixins.inspect_fn module

class FunctionInspectorMixin(*args, **kwargs)[source]

Bases: object

meerkat.mixins.io module

class ColumnIOMixin[source]

Bases: object

classmethod read(path: str, _data: Optional[object] = None, _meta: Optional[object] = None, *args, **kwargs) object[source]
write(path: str, *args, **kwargs) None[source]

meerkat.mixins.lambdable module

class LambdaMixin(*args, **kwargs)[source]

Bases: object

to_lambda(function: Callable, is_batched_fn: bool = False, batch_size: int = 1, inputs: Union[Mapping[str, str], Sequence[str]] = None, outputs: Union[Mapping[any, str], Sequence[str]] = None, output_type: Union[Mapping[str, type], type] = None) Union[DataPanel, LambdaColumn][source]

_summary_

Examples

Parameters
  • self

  • function (Callable) – The function that will be applied to the rows of self.

  • is_batched_fn (bool, optional) – Whether the function must be applied on a batch of rows. Defaults to False.

  • batch_size (int, optional) – The minimum batch size . Ignored if is_batched_fn=False. Defaults to 1.

  • inputs (Dict[str, str], optional) – Dictionary mapping column names in self to keyword arguments of function. Ignored if self is a column. When calling function values from the columns will be fed to the corresponding keyword arguments. Defaults to None, in which case the entire datapanel.

  • outputs (Union[Dict[any, str], Tuple[str]], optional) – Controls how the output of function is mapped to the returned LambdaColumn`(s). Defaults to None. * If ``None`, a single LambdaColumn is returned. * If a Dict[any, str], then a DataPanel containing LambdaColumn`s is returned. This is useful when the output of ``function` is a Dict. outputs maps the outputs of function to column names in the resulting DataPanel. * If a Tuple[str], then a DataPanel containing LambdaColumn`s is returned. , This is useful when the output of ``function` is a Tuple. outputs maps the outputs of function to column names in the resulting DataPanel.

  • output_type (Union[Dict[str, type], type], optional) – _description_. Defaults to None.

Raises

ValueError – _description_

Returns

_description_

Return type

_type_

to_lambda(data: Union[DataPanel, AbstractColumn], function: Callable, is_batched_fn: bool = False, batch_size: int = 1, inputs: Union[Mapping[str, str], Sequence[str]] = None, outputs: Union[Mapping[any, str], Sequence[str]] = None, output_type: Union[Mapping[str, type], type] = None) Union[DataPanel, LambdaColumn][source]

_summary_

Examples

Parameters
  • data

  • function (Callable) – The function that will be applied to the rows of data.

  • is_batched_fn (bool, optional) – Whether the function must be applied on a batch of rows. Defaults to False.

  • batch_size (int, optional) – The minimum batch size . Ignored if is_batched_fn=False. Defaults to 1.

  • inputs (Dict[str, str], optional) – Dictionary mapping column names in data to keyword arguments of function. Ignored if data is a column. When calling function values from the columns will be fed to the corresponding keyword arguments. Defaults to None, in which case the entire datapanel.

  • outputs (Union[Dict[any, str], Tuple[str]], optional) – Controls how the output of function is mapped to the returned LambdaColumn`(s). Defaults to None. * If ``None`, a single LambdaColumn is returned. * If a Dict[any, str], then a DataPanel containing LambdaColumn`s is returned. This is useful when the output of ``function` is a Dict. outputs maps the outputs of function to column names in the resulting DataPanel. * If a Tuple[str], then a DataPanel containing LambdaColumn`s is returned. , This is useful when the output of ``function` is a Tuple. outputs maps the outputs of function to column names in the resulting DataPanel.

  • output_type (Union[Dict[str, type], type], optional) – _description_. Defaults to None.

Raises

ValueError – _description_

Returns

_description_

Return type

_type_

meerkat.mixins.mapping module

class MappableMixin(*args, **kwargs)[source]

Bases: object

map(function: Optional[Callable] = None, with_indices: bool = False, is_batched_fn: bool = False, batch_size: Optional[int] = 1, drop_last_batch: bool = False, num_workers: Optional[int] = 0, output_type: Union[type, Dict[str, type]] = None, materialize: bool = True, pbar: bool = False, mmap: bool = False, mmap_path: str = None, flush_size: int = None, **kwargs)[source]

meerkat.mixins.materialize module

class MaterializationMixin(*args, **kwargs)[source]

Bases: object

property lz

Module contents