Github user icexelloss commented on a diff in the pull request:
https://github.com/apache/spark/pull/18732#discussion_r142448316
--- 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:
--- End diff --
Yeah.. the udf_obj here is actually a `<class 'function'>` because `udf`
and `pandas_udf` returns a `UserDefinedFunction.wrapped()` (to attach doc
string I believe).
Maybe it possible to change `udf` and `pandas_udf` to return a
`UserDefinedFunction` object and attach doc string to its `__call__` methods. I
can give it a try.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]