== ============ ======= 'introselect' 1 O(n) 0 no ================= ======= ============= ============ ======= All the partition algorithms make temporary copies of the data when partitioning along any but the last axis. Consequently, partitioning along the last axis is faster and uses less space than partitioning along any other axis. The sort order for complex numbers is lexicographic. If both the real and imaginary parts are non-nan then the order is determined by the real parts except when they are equal, in which case the order is determined by the imaginary parts. Examples -------- >>> a = np.array([7, 1, 7, 7, 1, 5, 7, 2, 3, 2, 6, 2, 3, 0]) >>> p = np.partition(a, 4) >>> p array([0, 1, 2, 1, 2, 5, 2, 3, 3, 6, 7, 7, 7, 7]) ``p[4]`` is 2; all elements in ``p[:4]`` are less than or equal to ``p[4]``, and all elements in ``p[5:]`` are greater than or equal to ``p[4]``. The partition is:: [0, 1, 2, 1], [2], [5, 2, 3, 3, 6, 7, 7, 7, 7] The next example shows the use of multiple values passed to `kth`. >>> p2 = np.partition(a, (4, 8)) >>> p2 array([0, 1, 2, 1, 2, 3, 3, 2, 5, 6, 7, 7, 7, 7]) ``p2[4]`` is 2 and ``p2[8]`` is 5. All elements in ``p2[:4]`` are less than or equal to ``p2[4]``, all elements in ``p2[5:8]`` are greater than or equal to ``p2[4]`` and less than or equal to ``p2[8]``, and all elements in ``p2[9:]`` are greater than or equal to ``p2[8]``. The partition is:: [0, 1, 2, 1], [2], [3, 3, 2], [5], [6, 7, 7, 7, 7] NrŠ