You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/10/12 04:22:21 UTC

[GitHub] [spark] yoda-mon commented on pull request #34240: [SPARK-36972][PYTHON]Add max_by/min_by API to PySpark

yoda-mon commented on pull request #34240:
URL: https://github.com/apache/spark/pull/34240#issuecomment-940644817


   @HyukjinKwon 
   
   I straggled with docstring but this kind of trials did not work...
   
   ```python
       >>> from pyspark.sql.functions import max_by
       >>> spark.createDataFrame([
       ...     ("Java", 2012, 20000),
       ...     ("dotNET", 2012, 5000),
       ...     ("dotNET", 2013, 48000),
       ...     ("Java", 2013, 30000)],
       ...     schema=("course", "year", "earnings")) \\
       ...     .groupby("course").agg(max_by("year", "earnings")).collect()
       :dedent:
       [Row(course='Java', max_by(year, earnings)=2013), \
       Row(course='dotNET', max_by(year, earnings)=2013)]
   ```
   I took around other functions and I'd like to switch to use `show` instead of `collect`, is it ok ?


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org