From 578795ff3871a47c46d52876091b58c844485d58 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Tue, 13 Sep 2022 04:18:51 -0400 Subject: [PATCH] feat(pandas): implement `StringReplace` execution --- ibis/backends/pandas/execution/strings.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ibis/backends/pandas/execution/strings.py b/ibis/backends/pandas/execution/strings.py index d8ca8f62cf25..a149ed8e9c77 100644 --- a/ibis/backends/pandas/execution/strings.py +++ b/ibis/backends/pandas/execution/strings.py @@ -357,6 +357,13 @@ def execute_series_right_gb(op, data, nchars, **kwargs): ) +@execute_node.register( + ops.StringReplace, pd.Series, (pd.Series, str), (pd.Series, str) +) +def execute_series_string_replace(_, data, needle, replacement, **kwargs): + return data.str.replace(needle, replacement) + + @execute_node.register(ops.StringJoin, (pd.Series, str), list) def execute_series_join_scalar_sep(op, sep, data, **kwargs): return reduce(lambda x, y: x + sep + y, data)