dask.dataframe.DataFrame.sort_values

DataFrame.sort_values(by, npartitions=None, ascending=True, na_position='last', **kwargs)[source]

Sort the dataset by a single column.

Sorting a parallel dataset requires expensive shuffles and is generally not recommended. See set_index for implementation details.

Parameters
by: string
npartitions: int, None, or ‘auto’

The ideal number of output partitions. If None, use the same as the input. If ‘auto’ then decide by memory use.

ascending: bool, optional

Sort ascending vs. descending. Defaults to True.

na_position: {‘last’, ‘first’}, optional

Puts NaNs at the beginning if ‘first’, puts NaN at the end if ‘last’. Defaults to ‘last’.

Examples

>>> df2 = df.sort_values('x')