bigframes.geopandas.GeoSeries.sort_values#
- GeoSeries.sort_values(*, axis=0, inplace: bool = False, ascending=True, kind: str = 'quicksort', na_position: Literal['first', 'last'] = 'last') Series | None#
Sort by the values.
Sort a Series in ascending or descending order by some criterion.
Examples:
>>> s = bpd.Series([np.nan, 1, 3, 10, 5]) >>> s 0 <NA> 1 1.0 2 3.0 3 10.0 4 5.0 dtype: Float64
Sort values ascending order (default behaviour):
>>> s.sort_values(ascending=True) 1 1.0 2 3.0 4 5.0 3 10.0 0 <NA> dtype: Float64
Sort values descending order:
>>> s.sort_values(ascending=False) 3 10.0 4 5.0 2 3.0 1 1.0 0 <NA> dtype: Float64
Sort values putting NAs first:
>>> s.sort_values(na_position='first') 0 <NA> 1 1.0 2 3.0 4 5.0 3 10.0 dtype: Float64
Sort a series of strings:
>>> s = bpd.Series(['z', 'b', 'd', 'a', 'c']) >>> s 0 z 1 b 2 d 3 a 4 c dtype: string
>>> s.sort_values() 3 a 1 b 4 c 2 d 0 z dtype: string
- Parameters:
axis (0 or 'index') – Unused. Parameter needed for compatibility with DataFrame.
inplace (bool, default False) – Whether to modify the Series rather than creating a new one.
ascending (bool or list of bools, default True) – If True, sort values in ascending order, otherwise descending.
kind (str, default to 'quicksort') – 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:
Series ordered by values or None if
inplace=True.- Return type:
bigframes.pandas.Series or None