xinrong-databricks commented on code in PR #36148:
URL: https://github.com/apache/spark/pull/36148#discussion_r850622966
##########
python/pyspark/pandas/groupby.py:
##########
@@ -426,16 +427,45 @@ def last(self) -> FrameLike:
lambda col: F.last(col, ignorenulls=True), only_numeric=False
)
- def max(self) -> FrameLike:
+ def max(self, numeric_only: Optional[bool] = False) -> FrameLike:
"""
Compute max of group values.
+ Parameters
+ ----------
+ numeric_only : bool, default False
+ Include only float, int, boolean columns. If None, will attempt to
use
+ everything, then use only numeric data.
+
+ .. versionadded:: 3.4.0
+
See Also
--------
pyspark.pandas.Series.groupby
pyspark.pandas.DataFrame.groupby
+
+ Examples
+ --------
+ >>> df = ps.DataFrame({"A": [1, 2, 1, 2], "B": [True, False, False,
True],
+ ... "C": [3, 4, 3, 4], "D": ["a", "b", "b", "a"]})
+
+ >>> df.groupby("A").max().sort_index()
+ B C D
+ A
+ 1 True 3 b
+ 2 True 4 b
Review Comment:
Thank you :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]