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