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

Method substitute

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

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