pyspark.sql.functions.
desc
Returns a sort expression based on the descending order of the given column name.
New in version 1.3.0.
Changed in version 3.4.0: Supports Spark Connect.
Column
target column to sort by in the descending order.
the column specifying the order.
Examples
Sort by the column ‘id’ in the descending order.
>>> spark.range(5).orderBy(desc("id")).show() +---+ | id| +---+ | 4| | 3| | 2| | 1| | 0| +---+