From f9b885e279e0a7cdc28d493e203077ceea38b094 Mon Sep 17 00:00:00 2001 From: jialuo Date: Mon, 25 Nov 2024 23:51:22 +0000 Subject: [PATCH 01/14] fix: fix read_gbq_function issue in dataframe apply method --- bigframes/dataframe.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index 185a756fed..e92f59d0e1 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -3674,7 +3674,11 @@ def apply(self, func, *, axis=0, args: typing.Tuple = (), **kwargs): return result_series # Per-column apply - results = {name: func(col, *args, **kwargs) for name, col in self.items()} + if hasattr(func, "bigframes_remote_function"): + results = {name: col.apply(func) for name, col in self.items()} + else: + results = {name: func(col, *args, **kwargs) for name, col in self.items()} + if all( [ isinstance(val, bigframes.series.Series) or utils.is_list_like(val) From e43636d70e7b50778e0120def9c9517389927fc9 Mon Sep 17 00:00:00 2001 From: jialuo Date: Mon, 2 Dec 2024 22:41:36 +0000 Subject: [PATCH 02/14] add a test --- tests/system/small/test_dataframe.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/system/small/test_dataframe.py b/tests/system/small/test_dataframe.py index 12ca13eb80..2a5240f46a 100644 --- a/tests/system/small/test_dataframe.py +++ b/tests/system/small/test_dataframe.py @@ -1161,6 +1161,30 @@ def test_apply_series_scalar_callable( pandas.testing.assert_series_equal(bf_result, pd_result) +def test_apply_from_read_gbq_function(dataset_id_permanent): + @bpd.remote_function( + dataset=dataset_id_permanent, + reuse=False, + name="tenfold", + ) + def tenfold(num: float) -> float: + return num * 10.0 + + # Read back the deployed BQ remote function via read_gbq_function. + func_ref = bpd.read_gbq_function( + function_name=tenfold.bigframes_remote_function, + is_row_processor=False, + ) + + data = {"a": [1.0, 2.0], "b": [3.0, 4.0], "c": [5.0, 6.0]} + bdf = bpd.DataFrame(data) + # Applying the remote function in different ways should result in the same results. + result = bdf.apply(tenfold).to_pandas() + result_gbq = bdf.apply(func_ref).to_pandas() + + pandas.testing.assert_frame_equal(result, result_gbq) + + def test_df_pipe( scalars_df_index, scalars_pandas_df_index, From 01e132fc63d155d8f38eb07271a44d17b53791d2 Mon Sep 17 00:00:00 2001 From: jialuo Date: Thu, 5 Dec 2024 19:34:03 +0000 Subject: [PATCH 03/14] fix the test --- tests/system/small/test_dataframe.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tests/system/small/test_dataframe.py b/tests/system/small/test_dataframe.py index 2a5240f46a..1e5136b8f5 100644 --- a/tests/system/small/test_dataframe.py +++ b/tests/system/small/test_dataframe.py @@ -1162,25 +1162,18 @@ def test_apply_series_scalar_callable( def test_apply_from_read_gbq_function(dataset_id_permanent): - @bpd.remote_function( - dataset=dataset_id_permanent, - reuse=False, - name="tenfold", - ) + @bpd.remote_function() def tenfold(num: float) -> float: return num * 10.0 # Read back the deployed BQ remote function via read_gbq_function. - func_ref = bpd.read_gbq_function( - function_name=tenfold.bigframes_remote_function, - is_row_processor=False, - ) + tenfold_ref = bpd.read_gbq_function(function_name=tenfold.bigframes_remote_function) data = {"a": [1.0, 2.0], "b": [3.0, 4.0], "c": [5.0, 6.0]} bdf = bpd.DataFrame(data) # Applying the remote function in different ways should result in the same results. result = bdf.apply(tenfold).to_pandas() - result_gbq = bdf.apply(func_ref).to_pandas() + result_gbq = bdf.apply(tenfold_ref).to_pandas() pandas.testing.assert_frame_equal(result, result_gbq) From 80978e50cbce2198c39916816e57b932f84f3bf0 Mon Sep 17 00:00:00 2001 From: jialuo Date: Fri, 13 Dec 2024 21:06:18 +0000 Subject: [PATCH 04/14] resolve the comments --- bigframes/dataframe.py | 5 +++++ bigframes/exceptions.py | 3 +++ tests/system/small/test_dataframe.py | 17 --------------- tests/system/small/test_remote_function.py | 24 ++++++++++++++++++++++ 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index e92f59d0e1..99f42c6abe 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -3675,6 +3675,11 @@ def apply(self, func, *, axis=0, args: typing.Tuple = (), **kwargs): # Per-column apply if hasattr(func, "bigframes_remote_function"): + if args or kwargs: + warnings.warn( + "The args and kwargs are not supported in the remote function.", + category=bigframes.exceptions.ArgsAndKwargsNotSupportedWarning, + ) results = {name: col.apply(func) for name, col in self.items()} else: results = {name: func(col, *args, **kwargs) for name, col in self.items()} diff --git a/bigframes/exceptions.py b/bigframes/exceptions.py index 27f3508ff4..fee59c6b2c 100644 --- a/bigframes/exceptions.py +++ b/bigframes/exceptions.py @@ -77,3 +77,6 @@ class ApiDeprecationWarning(FutureWarning): class BadIndexerKeyWarning(Warning): """The indexer key is not used correctly.""" + +class ArgsAndKwargsNotSupportedWarning(Warning): + """The args and kwargs are not supported.""" diff --git a/tests/system/small/test_dataframe.py b/tests/system/small/test_dataframe.py index 1e5136b8f5..12ca13eb80 100644 --- a/tests/system/small/test_dataframe.py +++ b/tests/system/small/test_dataframe.py @@ -1161,23 +1161,6 @@ def test_apply_series_scalar_callable( pandas.testing.assert_series_equal(bf_result, pd_result) -def test_apply_from_read_gbq_function(dataset_id_permanent): - @bpd.remote_function() - def tenfold(num: float) -> float: - return num * 10.0 - - # Read back the deployed BQ remote function via read_gbq_function. - tenfold_ref = bpd.read_gbq_function(function_name=tenfold.bigframes_remote_function) - - data = {"a": [1.0, 2.0], "b": [3.0, 4.0], "c": [5.0, 6.0]} - bdf = bpd.DataFrame(data) - # Applying the remote function in different ways should result in the same results. - result = bdf.apply(tenfold).to_pandas() - result_gbq = bdf.apply(tenfold_ref).to_pandas() - - pandas.testing.assert_frame_equal(result, result_gbq) - - def test_df_pipe( scalars_df_index, scalars_pandas_df_index, diff --git a/tests/system/small/test_remote_function.py b/tests/system/small/test_remote_function.py index c1ca0d04c0..881b38ed39 100644 --- a/tests/system/small/test_remote_function.py +++ b/tests/system/small/test_remote_function.py @@ -839,6 +839,30 @@ def test_read_gbq_function_enforces_explicit_types( ) +@pytest.mark.flaky(retries=2, delay=120) +def test_df_apply(session, scalars_dfs, dataset_id_permanent): + scalars_df, scalars_pandas_df = scalars_dfs + bdf = bigframes.pandas.DataFrame( + { + "Column1": scalars_df["string_col"], + "Column2": scalars_df["string_col"], + } + ) + + func_ref = session.read_gbq_function("bqutil.fn.cw_lower_case_ascii_only") + bf_result = bdf.apply(func_ref).to_pandas() + # The str.lower() method has the same functionality as func_ref. + pd_result = pd.DataFrame( + { + "Column1": scalars_pandas_df["string_col"].str.lower(), + "Column2": scalars_pandas_df["string_col"].str.lower(), + } + ) + + pd.testing.assert_series_equal(pd_result["Column1"], bf_result["Column1"]) + pd.testing.assert_series_equal(pd_result["Column2"], bf_result["Column2"]) + + @pytest.mark.flaky(retries=2, delay=120) def test_df_apply_axis_1(session, scalars_dfs, dataset_id_permanent): columns = [ From f61ef7e75e6ddc18284dc2acd09bd81429e1be76 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 13 Dec 2024 21:09:12 +0000 Subject: [PATCH 05/14] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- bigframes/exceptions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bigframes/exceptions.py b/bigframes/exceptions.py index fee59c6b2c..0dc9afdef0 100644 --- a/bigframes/exceptions.py +++ b/bigframes/exceptions.py @@ -78,5 +78,6 @@ class ApiDeprecationWarning(FutureWarning): class BadIndexerKeyWarning(Warning): """The indexer key is not used correctly.""" + class ArgsAndKwargsNotSupportedWarning(Warning): """The args and kwargs are not supported.""" From 3e4c846e42c523e56b94530045c063cd5efa1b10 Mon Sep 17 00:00:00 2001 From: jialuo Date: Fri, 13 Dec 2024 21:09:46 +0000 Subject: [PATCH 06/14] quick fix --- tests/system/small/test_remote_function.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/small/test_remote_function.py b/tests/system/small/test_remote_function.py index 881b38ed39..2e9c0cbe66 100644 --- a/tests/system/small/test_remote_function.py +++ b/tests/system/small/test_remote_function.py @@ -840,7 +840,7 @@ def test_read_gbq_function_enforces_explicit_types( @pytest.mark.flaky(retries=2, delay=120) -def test_df_apply(session, scalars_dfs, dataset_id_permanent): +def test_df_apply(session, scalars_dfs): scalars_df, scalars_pandas_df = scalars_dfs bdf = bigframes.pandas.DataFrame( { From 6cb007f9c6de8000f73bcd20b5b0c7809c95f183 Mon Sep 17 00:00:00 2001 From: jialuo Date: Mon, 6 Jan 2025 20:11:28 +0000 Subject: [PATCH 07/14] resolve comments --- bigframes/dataframe.py | 27 ++++++++++++++-------- tests/system/small/test_remote_function.py | 18 ++++++--------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index c6b087c852..8362fe2e33 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -3958,16 +3958,25 @@ def apply(self, func, *, axis=0, args: typing.Tuple = (), **kwargs): result_series.name = None return result_series + # This is when the func as a remote function is applied to each element of + # the dataframe (not supported). + # In Bigframes remote function, DataFrame '.apply' method is specifically + # designed to work with row-wise or column-wise operations, where the input + # to the applied function should be a Series, not a scalar. + if hasattr(func, 'is_row_processor') and not func.is_row_processor: + raise NotImplementedError( + "In Bigframes remote function, DataFrame '.apply()' does not " + "support element-wise application. Please use '.map()' instead." + ) + + if hasattr(func, 'bigframes_remote_function') and (args or kwargs): + warnings.warn( + "The args and kwargs are not supported in the remote function.", + category=bigframes.exceptions.ArgsAndKwargsNotSupportedWarning, + ) + # Per-column apply - if hasattr(func, "bigframes_remote_function"): - if args or kwargs: - warnings.warn( - "The args and kwargs are not supported in the remote function.", - category=bigframes.exceptions.ArgsAndKwargsNotSupportedWarning, - ) - results = {name: col.apply(func) for name, col in self.items()} - else: - results = {name: func(col, *args, **kwargs) for name, col in self.items()} + results = {name: func(col, *args, **kwargs) for name, col in self.items()} if all( [ diff --git a/tests/system/small/test_remote_function.py b/tests/system/small/test_remote_function.py index 3c5fd2c11e..3010ce5082 100644 --- a/tests/system/small/test_remote_function.py +++ b/tests/system/small/test_remote_function.py @@ -841,7 +841,7 @@ def test_read_gbq_function_enforces_explicit_types( @pytest.mark.flaky(retries=2, delay=120) def test_df_apply(session, scalars_dfs): - scalars_df, scalars_pandas_df = scalars_dfs + scalars_df, _ = scalars_dfs bdf = bigframes.pandas.DataFrame( { "Column1": scalars_df["string_col"], @@ -850,17 +850,13 @@ def test_df_apply(session, scalars_dfs): ) func_ref = session.read_gbq_function("bqutil.fn.cw_lower_case_ascii_only") - bf_result = bdf.apply(func_ref).to_pandas() - # The str.lower() method has the same functionality as func_ref. - pd_result = pd.DataFrame( - { - "Column1": scalars_pandas_df["string_col"].str.lower(), - "Column2": scalars_pandas_df["string_col"].str.lower(), - } - ) - pd.testing.assert_series_equal(pd_result["Column1"], bf_result["Column1"]) - pd.testing.assert_series_equal(pd_result["Column2"], bf_result["Column2"]) + with pytest.raises(NotImplementedError) as context: + bdf.apply(func_ref) + assert str(context.value) == ( + "In Bigframes remote function, DataFrame '.apply()' does not support " + "element-wise application. Please use '.map()' instead." + ) @pytest.mark.flaky(retries=2, delay=120) From 3a46848dd5fa490833d439837dcc38657f051d82 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 6 Jan 2025 20:14:31 +0000 Subject: [PATCH 08/14] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- bigframes/dataframe.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index 8362fe2e33..38b0f10b2d 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -3963,13 +3963,13 @@ def apply(self, func, *, axis=0, args: typing.Tuple = (), **kwargs): # In Bigframes remote function, DataFrame '.apply' method is specifically # designed to work with row-wise or column-wise operations, where the input # to the applied function should be a Series, not a scalar. - if hasattr(func, 'is_row_processor') and not func.is_row_processor: + if hasattr(func, "is_row_processor") and not func.is_row_processor: raise NotImplementedError( "In Bigframes remote function, DataFrame '.apply()' does not " "support element-wise application. Please use '.map()' instead." ) - if hasattr(func, 'bigframes_remote_function') and (args or kwargs): + if hasattr(func, "bigframes_remote_function") and (args or kwargs): warnings.warn( "The args and kwargs are not supported in the remote function.", category=bigframes.exceptions.ArgsAndKwargsNotSupportedWarning, From cc5fffa14dde5278e4f23ccb1f40d8f5af506b78 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 6 Jan 2025 20:14:41 +0000 Subject: [PATCH 09/14] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- bigframes/dataframe.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index 8362fe2e33..38b0f10b2d 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -3963,13 +3963,13 @@ def apply(self, func, *, axis=0, args: typing.Tuple = (), **kwargs): # In Bigframes remote function, DataFrame '.apply' method is specifically # designed to work with row-wise or column-wise operations, where the input # to the applied function should be a Series, not a scalar. - if hasattr(func, 'is_row_processor') and not func.is_row_processor: + if hasattr(func, "is_row_processor") and not func.is_row_processor: raise NotImplementedError( "In Bigframes remote function, DataFrame '.apply()' does not " "support element-wise application. Please use '.map()' instead." ) - if hasattr(func, 'bigframes_remote_function') and (args or kwargs): + if hasattr(func, "bigframes_remote_function") and (args or kwargs): warnings.warn( "The args and kwargs are not supported in the remote function.", category=bigframes.exceptions.ArgsAndKwargsNotSupportedWarning, From 553301f346453a0a370e3cb15f2d82181b7d8b13 Mon Sep 17 00:00:00 2001 From: jialuo Date: Mon, 13 Jan 2025 16:53:36 +0000 Subject: [PATCH 10/14] minor fix --- tests/system/small/test_remote_function.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/system/small/test_remote_function.py b/tests/system/small/test_remote_function.py index 3010ce5082..0bb8c7872d 100644 --- a/tests/system/small/test_remote_function.py +++ b/tests/system/small/test_remote_function.py @@ -840,7 +840,7 @@ def test_read_gbq_function_enforces_explicit_types( @pytest.mark.flaky(retries=2, delay=120) -def test_df_apply(session, scalars_dfs): +def test_df_apply_scalar_func(session, scalars_dfs): scalars_df, _ = scalars_dfs bdf = bigframes.pandas.DataFrame( { @@ -849,8 +849,10 @@ def test_df_apply(session, scalars_dfs): } ) + # The "cw_lower_case_ascii_only" is a scalar function. func_ref = session.read_gbq_function("bqutil.fn.cw_lower_case_ascii_only") + # DataFrame '.apply()' only supports series level application. with pytest.raises(NotImplementedError) as context: bdf.apply(func_ref) assert str(context.value) == ( From 5a998324174acc4da60d0d72e917e1bb46cc54f1 Mon Sep 17 00:00:00 2001 From: jialuo Date: Wed, 15 Jan 2025 00:02:41 +0000 Subject: [PATCH 11/14] resolve comments --- bigframes/dataframe.py | 18 +++++++++++------- bigframes/exceptions.py | 4 ---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index 38b0f10b2d..4138838196 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -3862,6 +3862,10 @@ def map(self, func, na_action: Optional[str] = None) -> DataFrame: ) def apply(self, func, *, axis=0, args: typing.Tuple = (), **kwargs): + # In Bigframes remote function, DataFrame '.apply' method is specifically + # designed to work with row-wise or column-wise operations, where the input + # to the applied function should be a Series, not a scalar. + if utils.get_axis_number(axis) == 1: warnings.warn( "axis=1 scenario is in preview.", @@ -3960,19 +3964,19 @@ def apply(self, func, *, axis=0, args: typing.Tuple = (), **kwargs): # This is when the func as a remote function is applied to each element of # the dataframe (not supported). - # In Bigframes remote function, DataFrame '.apply' method is specifically - # designed to work with row-wise or column-wise operations, where the input - # to the applied function should be a Series, not a scalar. if hasattr(func, "is_row_processor") and not func.is_row_processor: raise NotImplementedError( "In Bigframes remote function, DataFrame '.apply()' does not " "support element-wise application. Please use '.map()' instead." ) - if hasattr(func, "bigframes_remote_function") and (args or kwargs): - warnings.warn( - "The args and kwargs are not supported in the remote function.", - category=bigframes.exceptions.ArgsAndKwargsNotSupportedWarning, + # At this point column-wise operation will be performed (not supported). + if hasattr(func, "bigframes_remote_function"): + raise NotImplementedError( + "DataFrame '.apply()' does not support remote function for " + "column-wise application (i.e. with axis=0). Please use '.map()' " + "instead for element-wise application of the remote function, or " + "use regular python function for column-wise application." ) # Per-column apply diff --git a/bigframes/exceptions.py b/bigframes/exceptions.py index f168858f27..3cb5f3665d 100644 --- a/bigframes/exceptions.py +++ b/bigframes/exceptions.py @@ -81,7 +81,3 @@ class ApiDeprecationWarning(FutureWarning): class BadIndexerKeyWarning(Warning): """The indexer key is not used correctly.""" - - -class ArgsAndKwargsNotSupportedWarning(Warning): - """The args and kwargs are not supported.""" From 58134430240461720da000aca3eff43495a7e97a Mon Sep 17 00:00:00 2001 From: jialuo Date: Thu, 16 Jan 2025 18:57:27 +0000 Subject: [PATCH 12/14] resolve comments --- bigframes/dataframe.py | 18 ++++++------------ tests/system/small/test_remote_function.py | 6 ++++-- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index 56d7a98ea2..a79953f2d2 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -4020,21 +4020,15 @@ def apply(self, func, *, axis=0, args: typing.Tuple = (), **kwargs): result_series.name = None return result_series - # This is when the func as a remote function is applied to each element of - # the dataframe (not supported). - if hasattr(func, "is_row_processor") and not func.is_row_processor: - raise NotImplementedError( - "In Bigframes remote function, DataFrame '.apply()' does not " - "support element-wise application. Please use '.map()' instead." - ) - - # At this point column-wise operation will be performed (not supported). + # At this point column-wise or element-wise remote function operation will + # be performed (not supported). if hasattr(func, "bigframes_remote_function"): raise NotImplementedError( "DataFrame '.apply()' does not support remote function for " - "column-wise application (i.e. with axis=0). Please use '.map()' " - "instead for element-wise application of the remote function, or " - "use regular python function for column-wise application." + "element-wise or column-wise (i.e. with axis=0) application. " + "Please use '.map()' instead for element-wise application of the " + "remote function, or use regular python function for column-wise " + "application." ) # Per-column apply diff --git a/tests/system/small/test_remote_function.py b/tests/system/small/test_remote_function.py index 0bb8c7872d..1448cfe8d8 100644 --- a/tests/system/small/test_remote_function.py +++ b/tests/system/small/test_remote_function.py @@ -856,8 +856,10 @@ def test_df_apply_scalar_func(session, scalars_dfs): with pytest.raises(NotImplementedError) as context: bdf.apply(func_ref) assert str(context.value) == ( - "In Bigframes remote function, DataFrame '.apply()' does not support " - "element-wise application. Please use '.map()' instead." + "DataFrame '.apply()' does not support remote function for element-wise " + "or column-wise (i.e. with axis=0) application. Please use '.map()' " + "instead for element-wise application of the remote function, or use " + "regular python function for column-wise application." ) From 010cf9e077ced6230a5ed4da83b31fb60db0e81b Mon Sep 17 00:00:00 2001 From: jialuoo Date: Fri, 17 Jan 2025 11:03:39 -0800 Subject: [PATCH 13/14] Update dataframe.py --- bigframes/dataframe.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index 0337751867..7f7268a9d5 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -4039,11 +4039,10 @@ def apply(self, func, *, axis=0, args: typing.Tuple = (), **kwargs): # be performed (not supported). if hasattr(func, "bigframes_remote_function"): raise NotImplementedError( - "DataFrame '.apply()' does not support remote function for " - "element-wise or column-wise (i.e. with axis=0) application. " - "Please use '.map()' instead for element-wise application of the " - "remote function, or use regular python function for column-wise " - "application." + "BigFrames DataFrame '.apply()' does not support remote function " + "for column-wise (i.e. with axis=0) operations, please use a " + "regular python function instead. For element-wise operations of " + "the remote function, please use '.map()'." ) # Per-column apply From 65d307a054954438dda7c34c7c174b77601374dc Mon Sep 17 00:00:00 2001 From: jialuoo Date: Fri, 17 Jan 2025 11:04:52 -0800 Subject: [PATCH 14/14] Update test_remote_function.py --- tests/system/small/test_remote_function.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/system/small/test_remote_function.py b/tests/system/small/test_remote_function.py index 97b0b7cb28..c3f3890459 100644 --- a/tests/system/small/test_remote_function.py +++ b/tests/system/small/test_remote_function.py @@ -985,10 +985,10 @@ def test_df_apply_scalar_func(session, scalars_dfs): with pytest.raises(NotImplementedError) as context: bdf.apply(func_ref) assert str(context.value) == ( - "DataFrame '.apply()' does not support remote function for element-wise " - "or column-wise (i.e. with axis=0) application. Please use '.map()' " - "instead for element-wise application of the remote function, or use " - "regular python function for column-wise application." + "BigFrames DataFrame '.apply()' does not support remote function for " + "column-wise (i.e. with axis=0) operations, please use a regular python " + "function instead. For element-wise operations of the remote function, " + "please use '.map()'." )