@@ -530,7 +530,7 @@ def set_axis(self, labels, axis=0, inplace=None):
530
530
The axis to update. The value 0 identifies the rows, and 1
531
531
identifies the columns.
532
532
533
- inplace : boolean , default None
533
+ inplace : bool , default None
534
534
Whether to return a new %(klass)s instance.
535
535
536
536
.. warning::
@@ -3966,35 +3966,37 @@ def add_suffix(self, suffix):
3966
3966
def sort_values (self , by = None , axis = 0 , ascending = True , inplace = False ,
3967
3967
kind = 'quicksort' , na_position = 'last' ):
3968
3968
"""
3969
- Sort by the values along either axis
3969
+ Sort by the values along either axis.
3970
3970
3971
3971
Parameters
3972
3972
----------%(optional_by)s
3973
3973
axis : %(axes_single_arg)s, default 0
3974
- Axis to be sorted
3974
+ Axis to be sorted.
3975
3975
ascending : bool or list of bool, default True
3976
3976
Sort ascending vs. descending. Specify list for multiple sort
3977
3977
orders. If this is a list of bools, must match the length of
3978
3978
the by.
3979
3979
inplace : bool, default False
3980
- if True, perform operation in-place
3980
+ If True, perform operation in-place.
3981
3981
kind : {'quicksort', 'mergesort', 'heapsort'}, default 'quicksort'
3982
3982
Choice of sorting algorithm. See also ndarray.np.sort for more
3983
3983
information. `mergesort` is the only stable algorithm. For
3984
3984
DataFrames, this option is only applied when sorting on a single
3985
3985
column or label.
3986
3986
na_position : {'first', 'last'}, default 'last'
3987
- `first` puts NaNs at the beginning, `last` puts NaNs at the end
3987
+ Puts NaNs at the beginning if `first`; `last` puts NaNs at the
3988
+ end.
3988
3989
3989
3990
Returns
3990
3991
-------
3991
- sorted_obj : %(klass)s
3992
+ sorted_obj : DataFrame or None
3993
+ DataFrame with sorted values if inplace=False, None otherwise.
3992
3994
3993
3995
Examples
3994
3996
--------
3995
3997
>>> df = pd.DataFrame({
3996
- ... 'col1' : ['A', 'A', 'B', np.nan, 'D', 'C'],
3997
- ... 'col2' : [2, 1, 9, 8, 7, 4],
3998
+ ... 'col1': ['A', 'A', 'B', np.nan, 'D', 'C'],
3999
+ ... 'col2': [2, 1, 9, 8, 7, 4],
3998
4000
... 'col3': [0, 1, 9, 4, 2, 3],
3999
4001
... })
4000
4002
>>> df
@@ -4056,32 +4058,35 @@ def sort_values(self, by=None, axis=0, ascending=True, inplace=False,
4056
4058
def sort_index (self , axis = 0 , level = None , ascending = True , inplace = False ,
4057
4059
kind = 'quicksort' , na_position = 'last' , sort_remaining = True ):
4058
4060
"""
4059
- Sort object by labels (along an axis)
4061
+ Sort object by labels (along an axis).
4060
4062
4061
4063
Parameters
4062
4064
----------
4063
- axis : %(axes)s to direct sorting
4065
+ axis : {0 or 'index', 1 or 'columns'}, default 0
4066
+ The axis along which to sort. The value 0 identifies the rows,
4067
+ and 1 identifies the columns.
4064
4068
level : int or level name or list of ints or list of level names
4065
- if not None, sort on values in specified index level(s)
4066
- ascending : boolean , default True
4067
- Sort ascending vs. descending
4069
+ If not None, sort on values in specified index level(s).
4070
+ ascending : bool , default True
4071
+ Sort ascending vs. descending.
4068
4072
inplace : bool, default False
4069
- if True, perform operation in-place
4073
+ If True, perform operation in-place.
4070
4074
kind : {'quicksort', 'mergesort', 'heapsort'}, default 'quicksort'
4071
- Choice of sorting algorithm. See also ndarray.np.sort for more
4072
- information. `mergesort` is the only stable algorithm. For
4073
- DataFrames, this option is only applied when sorting on a single
4074
- column or label.
4075
+ Choice of sorting algorithm. See also ndarray.np.sort for more
4076
+ information. `mergesort` is the only stable algorithm. For
4077
+ DataFrames, this option is only applied when sorting on a single
4078
+ column or label.
4075
4079
na_position : {'first', 'last'}, default 'last'
4076
- `first` puts NaNs at the beginning, `last` puts NaNs at the end.
4077
- Not implemented for MultiIndex.
4080
+ Puts NaNs at the beginning if `first`; `last` puts NaNs at the end.
4081
+ Not implemented for MultiIndex.
4078
4082
sort_remaining : bool, default True
4079
- if true and sorting by level and index is multilevel, sort by other
4080
- levels too (in order) after sorting by specified level
4083
+ If True and sorting by level and index is multilevel, sort by other
4084
+ levels too (in order) after sorting by specified level.
4081
4085
4082
4086
Returns
4083
4087
-------
4084
- sorted_obj : %(klass)s
4088
+ sorted_obj : DataFrame or None
4089
+ DataFrame with sorted index if inplace=False, None otherwise.
4085
4090
"""
4086
4091
inplace = validate_bool_kwarg (inplace , 'inplace' )
4087
4092
axis = self ._get_axis_number (axis )
0 commit comments