meerkat.mixins package
Submodules
meerkat.mixins.blockable module
meerkat.mixins.cloneable module
meerkat.mixins.collate module
meerkat.mixins.file module
meerkat.mixins.inspect_fn module
meerkat.mixins.io module
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
selfto keyword arguments offunction. Ignored ifselfis a column. When callingfunctionvalues 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
functionis mapped to the returnedLambdaColumn`(s). Defaults to None. * If ``None`, a singleLambdaColumnis returned. * If aDict[any, str], then aDataPanelcontainingLambdaColumn`s is returned. This is useful when the output of ``function`is aDict.outputsmaps the outputs offunctionto column names in the resultingDataPanel. * If aTuple[str], then aDataPanelcontainingLambdaColumn`s is returned. , This is useful when the output of ``function`is aTuple.outputsmaps the outputs offunctionto column names in the resultingDataPanel.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
datato keyword arguments offunction. Ignored ifdatais a column. When callingfunctionvalues 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
functionis mapped to the returnedLambdaColumn`(s). Defaults to None. * If ``None`, a singleLambdaColumnis returned. * If aDict[any, str], then aDataPanelcontainingLambdaColumn`s is returned. This is useful when the output of ``function`is aDict.outputsmaps the outputs offunctionto column names in the resultingDataPanel. * If aTuple[str], then aDataPanelcontainingLambdaColumn`s is returned. , This is useful when the output of ``function`is aTuple.outputsmaps the outputs offunctionto column names in the resultingDataPanel.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]