bigframes.pandas.DataFrame.sort_index#

DataFrame.sort_index(*, ascending: bool = True, inplace: Literal[False] = False, kind: str | None = None, na_position: Literal['first', 'last'] = 'last') DataFrame[source]#
DataFrame.sort_index(*, ascending: bool = True, inplace: Literal[True] = False, kind: str | None = None, na_position: Literal['first', 'last'] = 'last') None

Sort object by labels (along an axis).

Parameters:
  • axis ({0 or 'index', 1 or 'columns'}, default 0) – The axis along which to sort. The value 0 identifies the rows, and 1 identifies the columns.

  • ascending (bool, default True) – Sort ascending vs. descending.

  • inplace (bool, default False) – Whether to modify the DataFrame rather than creating a new one.

  • 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', 'last'}, default 'last') – Puts NaNs at the beginning if first; last puts NaNs at the end. Not implemented for MultiIndex.

Returns:

DataFrame with sorted values or None if inplace=True.

Return type:

bigframes.pandas.DataFrame

Raises:
  • ValueError – If value of na_position is not one of first or last.

  • ValueError – If length of ascending dose not equal length of by.