Sort

Sorts input DataFrame according to the given columns.

User selects columns by name or index. He may also specify the ascending/descending order for each column.

The sort is performed as in the SQL’s ORDER BY clause - the first selected column is given the highest priority, subsequent columns are taken into account only when the comparison on the earlier ones is not enough to determine the rows’ ordering.

Since: Seahorse 1.4.0

Input

Port Data Type Description
0 DataFrame Input DataFrame.

Output

Port Data Type Description
0 DataFrame DataFrame sorted by the given columns.

Parameters

Name Type Description
sort columnsParameters SequenceSequence of single column selectors each augmented with boolean descending flag.

Example

Parameters

Name Value
sort columns Sort by city ASC, price DESC

Input

city beds price
CityA 4.0 695611.0
CityC 2.0 294691.0
CityB 3.0 430784.0
CityB 2.0 336677.0
CityA 3.0 584639.0
CityA 4.0 579560.0

Output

city beds price
CityA 4.0 695611.0
CityA 3.0 584639.0
CityA 4.0 579560.0
CityB 3.0 430784.0
CityB 2.0 336677.0
CityC 2.0 294691.0