bigframes.pandas.Index.sort_values#

Index.sort_values(*, inplace: bool = False, ascending: bool = True, kind: str | None = None, na_position: str = 'last') Index[source]#

Return a sorted copy of the index.

Return a sorted copy of the index, and optionally return the indices that sorted the index itself.

Examples:

>>> idx = bpd.Index([10, 100, 1, 1000])
>>> idx
Index([10, 100, 1, 1000], dtype='Int64')

Sort values in ascending order (default behavior).

>>> idx.sort_values()
Index([1, 10, 100, 1000], dtype='Int64')
Parameters:
  • ascending (bool, default True) – Should the index values be sorted in an ascending order.

  • kind (str, default None) – Choice of sorting algorithm. Accepts ‘quicksort’, ‘mergesort’, ‘heapsort’, ‘stable’. Ignored except when determining whether to sort stably. ‘mergesort’ or ‘stable’ will result in stable reorder.

  • na_position ({'first' or 'last'}, default 'last') – Argument ‘first’ puts NaNs at the beginning, ‘last’ puts NaNs at the end.

Returns:

Sorted copy of the index.

Return type:

pandas.Index

Raises:

ValueError – If no_position is not one of first or last.