summaryrefslogtreecommitdiff
path: root/numpy/core/fromnumeric.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2015-06-01 10:01:20 -0600
committerCharles Harris <charlesr.harris@gmail.com>2015-06-01 10:01:20 -0600
commitc8202592bb8d85c22c643d15d07889b9b9e7f09e (patch)
tree8c6389fc28b7ba91e92d3e8dd0882b1b7115bbbf /numpy/core/fromnumeric.py
parentd9ab8f76543f120d67d3e33ae667860924d00971 (diff)
parent5be67675762180503e1b3c4824d2009d3614f181 (diff)
downloadnumpy-c8202592bb8d85c22c643d15d07889b9b9e7f09e.tar.gz
Merge pull request #5928 from jaimefrio/sort_order_doc
DOC: Better document 'order' argument of 'sort' and friends
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r--numpy/core/fromnumeric.py36
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
-------