Github user icexelloss commented on a diff in the pull request:
https://github.com/apache/spark/pull/18732#discussion_r142478440
--- 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 --
It seems `foo?` and `foo??` only shows the property doc string if `foo` is
a `function`.
If `foo` is a `UserDefinedFunction`, it will show the docstring for the
class.
For that reason, I think we should keep the return value of `udf` and
`pandas_udf` to be a wrapped function. And I will do checks on `udf_obj.func`
to see if this is a valid wrapped udf function. @BryanCutler what do you think?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]