12. Sorting

Index, Series and Frame provide sorting. In all cases, a new object is returned.

12.1. Index

Index.sort(ascending: bool = True, kind: str = 'mergesort') → static_frame.core.index.Index[source]

Return a new Index with the labels sorted.

Parameters

kind – Sort algorithm passed to NumPy.

12.2. Series

Series.sort_index(ascending: bool = True, kind: str = 'mergesort') → static_frame.core.series.Series[source]

Return a new Series ordered by the sorted Index.

Series.sort_values(ascending: bool = True, kind: str = 'mergesort') → static_frame.core.series.Series[source]

Return a new Series ordered by the sorted values.

12.3. Frame

Frame.sort_index(ascending: bool = True, kind: str = 'mergesort') → static_frame.core.frame.Frame[source]

Return a new Frame ordered by the sorted Index.

Frame.sort_columns(ascending: bool = True, kind: str = 'mergesort') → static_frame.core.frame.Frame[source]

Return a new Frame ordered by the sorted Columns.

Frame.sort_values(key: Union[Hashable, Iterable[Hashable]], ascending: bool = True, axis: int = 1, kind='mergesort') → static_frame.core.frame.Frame[source]

Return a new Frame ordered by the sorted values, where values is given by single column or iterable of columns.

Parameters

key – a key or tuple of keys. Presently a list is not supported.

Deviations from Pandas

The default sort kind, delegated to NumPy sorting routines, is merge sort, a stable sort. In some versions of Pandas the default sort kind is quicksort.