dpnp.dpnp_array.dpnp_array.partition

method

dpnp_array.partition(kth, axis=-1, kind='introselect', order=None)[source]

Return a partitioned copy of an array.

Rearranges the elements in the array in such a way that the value of the element in kth position is in the position it would be in a sorted array.

All elements smaller than the kth element are moved before this element and all equal or greater are moved behind it. The ordering of the elements in the two partitions is undefined.

Refer to dpnp.partition for full documentation.

See also

dpnp.partition

Return a partitioned copy of an array.

Examples

>>> import dpnp as np
>>> a = np.array([3, 4, 2, 1])
>>> a.partition(3)
>>> a
array([1, 2, 3, 4])