diff --git a/bigframes/series.py b/bigframes/series.py index 87f1f1d141..37a3723a0a 100644 --- a/bigframes/series.py +++ b/bigframes/series.py @@ -1712,9 +1712,18 @@ def apply( # as a whole. if by_row: raise ValueError( - "A vectorized non-BigFrames BigQuery function can be " - "provided only with by_row=False. For element-wise operation " - "it must be a BigFrames BigQuery function." + "You have passed a function as-is. If your intention is to " + "apply this function in a vectorized way (i.e. to the " + "entire Series as a whole, and you are sure that it " + "performs only the operations that are implemented for a " + "Series (e.g. a chain of arithmetic/logical operations, " + "such as `def foo(s): return s % 2 == 1`), please also " + "specify `by_row=False`. If your function contains " + "arbitrary code, it can only be applied to every element " + "in the Series individually, in which case you must " + "convert it to a BigFrames BigQuery function using " + "`bigframes.pandas.udf`, " + "or `bigframes.pandas.remote_function` before passing." ) try: