Spark DataFrame groupBy and sort in the descending order (pyspark)

后端 未结 5 1136
我在风中等你
我在风中等你 2021-01-30 07:46

I\'m using pyspark(Python 2.7.9/Spark 1.3.1) and have a dataframe GroupObject which I need to filter & sort in the descending order. Trying to achieve it via this piece of c

5条回答
  •  臣服心动
    2021-01-30 08:49

    Use orderBy:

    df.orderBy('column_name', ascending=False)
    

    Complete answer:

    group_by_dataframe.count().filter("`count` >= 10").orderBy('count', ascending=False)
    

    http://spark.apache.org/docs/2.0.0/api/python/pyspark.sql.html

提交回复
热议问题