Apr-03-2019, 05:38 PM
Hi Frnds,
I'm new to numpy.. Can you please explain how the builtin function argpartition works?
I'm new to numpy.. Can you please explain how the builtin function argpartition works?
>>> x = np.array([3, 4, 2, 1]) >>> x[np.argpartition(x, 3)] array([2, 1, 3, 4]) >>> x[np.argpartition(x, (1, 3))] array([1, 2, 3, 4]) >>> >>> x = [3, 4, 2, 1] >>> np.array(x)[np.argpartition(x, 3)] array([2, 1, 3, 4])I tried to understand the above example, but unfortunately I couldn't..:(