Github user BryanCutler commented on a diff in the pull request: https://github.com/apache/spark/pull/18732#discussion_r142244781 --- Diff: python/pyspark/sql/group.py --- @@ -194,6 +194,37 @@ def pivot(self, pivot_col, values=None): jgd = self._jgd.pivot(pivot_col, values) return GroupedData(jgd, self.sql_ctx) + def apply(self, udf_obj): + """ + Maps each group of the current [[DataFrame]] using a pandas udf and returns the result + as a :class:`DataFrame`. + + """ + from pyspark.sql.functions import pandas_udf + + if not udf_obj._vectorized: + raise ValueError("Must pass a pandas_udf") + if not isinstance(udf_obj.returnType, StructType): + raise ValueError("Must pass a StructType as return type in pandas_udf") --- End diff -- Similar to above, maybe: "The pandas_udf in apply() must return a StructType"
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org