Description
DataFrameGroupBy.apply without shortcut could raise an exception when it returns Series.
>>> ps.options.compute.shortcut_limit = 3 >>> psdf = ps.DataFrame( ... {"a": [1, 2, 3, 4, 5, 6], "b": [1, 1, 2, 3, 5, 8], "c": [1, 4, 9, 16, 25, 36]}, ... columns=["a", "b", "c"], ... ) >>> psdf.groupby("b").apply(lambda x: x["a"]) org.apache.spark.api.python.PythonException: Traceback (most recent call last): ... ValueError: Length mismatch: Expected axis has 2 elements, new values have 3 elements