MCPcopy Create free account
hub / github.com/dask/dask / MapPartitions

Class MapPartitions

dask/dataframe/dask_expr/_expr.py:651–795  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

649
650
651class MapPartitions(Blockwise):
652 _parameters = [
653 "frame",
654 "func",
655 "meta",
656 "enforce_metadata",
657 "transform_divisions",
658 "clear_divisions",
659 "align_dataframes",
660 "parent_meta",
661 "required_columns",
662 "token",
663 "kwargs",
664 "nargs",
665 ]
666 _defaults: dict = {
667 "kwargs": None,
668 "align_dataframes": True,
669 "parent_meta": None,
670 "required_columns": None,
671 "token": None,
672 "nargs": 0,
673 }
674
675 @functools.cached_property
676 def token(self):
677 if "token" in self._parameters:
678 return self.operand("token")
679 return None
680
681 def __str__(self):
682 return f"MapPartitions({funcname(self.func)})"
683
684 @functools.cached_property
685 def _name(self):
686 if self.token is not None:
687 head = self.token
688 else:
689 head = funcname(self.func).lower()
690 return f"{head}-{self.deterministic_token}"
691
692 def _broadcast_dep(self, dep: Expr):
693 # Always broadcast single-partition dependencies in MapPartitions
694 return dep.npartitions == 1
695
696 @functools.cached_property
697 def args(self):
698 return [self.frame] + self.operands[
699 len(self._parameters) : len(self._parameters) + self.nargs
700 ]
701
702 @functools.cached_property
703 def _meta(self):
704 meta = self.operand("meta")
705 return _get_meta_map_partitions(
706 self.args,
707 [
708 e

Callers 4

_lowerMethod · 0.90
_lowerMethod · 0.90
_lowerMethod · 0.90
_lowerMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected