Skip to main content
Version: Python

sort_descending

sort_descending sorts rows in a table in a largest to smallest order based on the column(s) listed in the order_by argument.

Syntax

sort_descending(order_by: Union[str, Sequence[str]]) -> Table

Parameters

ParameterTypeDescription
order_byUnion[str, Sequence[str]]

The column(s) used for sorting.

Returns

A new table where rows in a table are sorted in a largest to smallest order based on the column(s) listed in the order_by argument.

Examples

from deephaven import new_table
from deephaven.column import string_col, int_col

source = new_table(
[
string_col("Letter", ["A", "C", "F", "B", "E", "D"]),
int_col("Number", [6, 2, 1, 3, 4, 5]),
]
)

result = source.sort_descending(order_by=["Letter"])
from deephaven import new_table
from deephaven.column import string_col, int_col

source = new_table(
[
string_col("Letter", ["A", "B", "A", "B", "B", "A"]),
int_col("Number", [6, 2, 1, 3, 4, 5]),
string_col("Color", ["red", "blue", "orange", "purple", "yellow", "pink"]),
]
)

result = source.sort_descending(order_by=["Letter", "Number"])