pyspark.sql.Column.desc

Column.desc()

Returns a sort expression based on the descending order of the column.

New in version 2.4.0.

Examples

>>> from pyspark.sql import Row
>>> df = spark.createDataFrame([('Tom', 80), ('Alice', None)], ["name", "height"])
>>> df.select(df.name).orderBy(df.name.desc()).collect()
[Row(name='Tom'), Row(name='Alice')]