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

Method substitute

dask/_expr.py:601–620  ·  view source on GitHub ↗

Substitute a specific term within the expression Note that replacing non-`Expr` terms may produce unexpected results, and is not recommended. Substituting boolean values is not allowed. Parameters ---------- old: Old term to find and repl

(self, old, new)

Source from the content-addressed store, hash-verified

599 return self.__dask_graph__()
600
601 def substitute(self, old, new) -> Expr:
602 """Substitute a specific term within the expression
603
604 Note that replacing non-`Expr` terms may produce
605 unexpected results, and is not recommended.
606 Substituting boolean values is not allowed.
607
608 Parameters
609 ----------
610 old:
611 Old term to find and replace.
612 new:
613 New term to replace instances of `old` with.
614
615 Examples
616 --------
617 >>> (df + 10).substitute(10, 20) # doctest: +SKIP
618 df + 20
619 """
620 return self._substitute(old, new, _seen=set())
621
622 def _substitute(self, old, new, _seen):
623 if self._name in _seen:

Callers 15

__dask_graph__Method · 0.45
cloneMethod · 0.45
_make_blockwise_graphFunction · 0.45
rewrite_blockwiseFunction · 0.45
_simplify_upMethod · 0.45
_simplify_upMethod · 0.45
_simplify_upMethod · 0.45
_fusion_passFunction · 0.45
_simplify_upMethod · 0.45
_tune_upMethod · 0.45

Calls 2

_substituteMethod · 0.95
setClass · 0.85

Tested by 3

test_substituteFunction · 0.36
test_task_eqFunction · 0.36