Skip to main content

Order By

Sorts dataframe on one or more columns in ascending or descending order.

Parameters

ParameterDescriptionRequired
DataframeInput dataframe which needs to be sortedTrue
Order columnsColumns to sort dataframe byTrue
SortOrder of sorting - ascending or descendingTrue

Example

Example usage of OrderBy

Spark Code

def Sort(spark: SparkSession, in0: DataFrame) -> DataFrame:
return in0.orderBy(col("name").asc(), col("updated_at").desc())