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)
| 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: |