# dask.dataframe.DataFrame.sort_values

#### DataFrame.sort_values(by: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[str](https://docs.python.org/3/builtins/stdtypes.html#str)], npartitions: [int](https://docs.python.org/3/builtins/functions.html#int) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, ascending: [bool](https://docs.python.org/3/builtins/functions.html#bool) | [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[bool](https://docs.python.org/3/builtins/functions.html#bool)] = True, na_position: [Literal](https://docs.python.org/3/library/typing.html#typing.Literal)['first', 'last'] = 'last', partition_size: [float](https://docs.python.org/3/builtins/functions.html#float) = 128000000.0, sort_function: [Callable](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable)[[[DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html#pandas.DataFrame)], [DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html#pandas.DataFrame)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, sort_function_kwargs: [Mapping](https://docs.python.org/3/library/collections.abc.html#collections.abc.Mapping)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [Any](https://docs.python.org/3/library/typing.html#typing.Any)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, upsample: [float](https://docs.python.org/3/builtins/functions.html#float) = 1.0, ignore_index: [bool](https://docs.python.org/3/builtins/functions.html#bool) | [None](https://docs.python.org/3/builtins/constants.html#None) = False, shuffle_method: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, \*\*options)

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: str or list[str]**
  : Column(s) to sort by.

  **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’.

  **sort_function: function, optional**
  : Sorting function to use when sorting underlying partitions.
    If None, defaults to `M.sort_values` (the partition library’s
    implementation of `sort_values`).

  **sort_function_kwargs: dict, optional**
  : Additional keyword arguments to pass to the partition sorting function.
    By default, `by`, `ascending`, and `na_position` are provided.

### Examples

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

<!-- !! processed by numpydoc !! -->
