Below are different ways to sort a dataframe:
- sort
- df.sort(df.ColumnName)
- df.sort(df.ColumnName.desc())
- df.sort(df.ColumnName.desc(), df.ColumnName2)
- df.sort(col("ColumnName"))
- orderBy
- df.orderBy(df.ColumnName)
- df.orderBy(df.ColumnName.desc())
- df.orderBy(df.ColumnName1.desc(), df.ColumnName2)
- df.orderBy(col("ColumnName"))
No comments:
Post a Comment