diff options
author | Jaime Fernandez <jaime.frio@gmail.com> | 2015-05-30 14:19:07 -0700 |
---|---|---|
committer | Jaime Fernandez <jaime.frio@gmail.com> | 2015-05-30 14:19:07 -0700 |
commit | 5be67675762180503e1b3c4824d2009d3614f181 (patch) | |
tree | b26b2509bbbce1b71eea411b17c0a867b2019915 /numpy/core/fromnumeric.py | |
parent | a3ffea107820c06a62fd74c4dff1a51bd1ebb284 (diff) | |
download | numpy-5be67675762180503e1b3c4824d2009d3614f181.tar.gz |
DOC: Better document 'order' argument of 'sort' and friends
Closes #5927
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r-- | numpy/core/fromnumeric.py | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index e581f0d49..3741d821d 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -579,10 +579,12 @@ def partition(a, kth, axis=-1, kind='introselect', order=None): sorting. The default is -1, which sorts along the last axis. kind : {'introselect'}, optional Selection algorithm. Default is 'introselect'. - order : list, optional - When `a` is a structured array, this argument specifies which fields - to compare first, second, and so on. This list does not need to - include all of the fields. + order : str or list of str, optional + When `a` is an array with fields defined, this argument specifies + which fields to compare first, second, etc. A single field can + be specified as a string. Not all fields need be specified, but + unspecified fields will still be used, in the order in which they + come up in the dtype, to break ties. Returns ------- @@ -662,10 +664,12 @@ def argpartition(a, kth, axis=-1, kind='introselect', order=None): the flattened array is used. kind : {'introselect'}, optional Selection algorithm. Default is 'introselect' - order : list, optional + order : str or list of str, optional When `a` is an array with fields defined, this argument specifies - which fields to compare first, second, etc. Not all fields need be - specified. + which fields to compare first, second, etc. A single field can + be specified as a string, and not all fields need be specified, + but unspecified fields will still be used, in the order in which + they come up in the dtype, to break ties. Returns ------- @@ -718,10 +722,12 @@ def sort(a, axis=-1, kind='quicksort', order=None): sorting. The default is -1, which sorts along the last axis. kind : {'quicksort', 'mergesort', 'heapsort'}, optional Sorting algorithm. Default is 'quicksort'. - order : list, optional - When `a` is a structured array, this argument specifies which fields - to compare first, second, and so on. This list does not need to - include all of the fields. + order : str or list of str, optional + When `a` is an array with fields defined, this argument specifies + which fields to compare first, second, etc. A single field can + be specified as a string, and not all fields need be specified, + but unspecified fields will still be used, in the order in which + they come up in the dtype, to break ties. Returns ------- @@ -831,10 +837,12 @@ def argsort(a, axis=-1, kind='quicksort', order=None): the flattened array is used. kind : {'quicksort', 'mergesort', 'heapsort'}, optional Sorting algorithm. - order : list, optional + order : str or list of str, optional When `a` is an array with fields defined, this argument specifies - which fields to compare first, second, etc. Not all fields need be - specified. + which fields to compare first, second, etc. A single field can + be specified as a string, and not all fields need be specified, + but unspecified fields will still be used, in the order in which + they come up in the dtype, to break ties. Returns ------- |