MCPcopy
hub / github.com/dask/dask / substitute

Method substitute

dask/_expr.py:586–605  ·  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

584 return self.__dask_graph__()
585
586 def substitute(self, old, new) -> Expr:
587 """Substitute a specific term within the expression
588
589 Note that replacing non-`Expr` terms may produce
590 unexpected results, and is not recommended.
591 Substituting boolean values is not allowed.
592
593 Parameters
594 ----------
595 old:
596 Old term to find and replace.
597 new:
598 New term to replace instances of `old` with.
599
600 Examples
601 --------
602 >>> (df + 10).substitute(10, 20) # doctest: +SKIP
603 df + 20
604 """
605 return self._substitute(old, new, _seen=set())
606
607 def _substitute(self, old, new, _seen):
608 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