pyspark.sql.functions.desc¶
- 
pyspark.sql.functions.desc(col: ColumnOrName) → pyspark.sql.column.Column[source]¶
- 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. - Parameters
- colColumnor str
- target column to sort by in the descending order. 
 
- col
- Returns
- Column
- 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| +---+