MCPcopy Create free account
hub / github.com/numpy/numpy / msort

Function msort

numpy/lib/function_base.py:3718–3760  ·  view source on GitHub ↗

Return a copy of an array sorted along the first axis. .. deprecated:: 1.24 msort is deprecated, use ``np.sort(a, axis=0)`` instead. Parameters ---------- a : array_like Array to be sorted. Returns ------- sorted_array : ndarray Array of th

(a)

Source from the content-addressed store, hash-verified

3716
3717@array_function_dispatch(_msort_dispatcher)
3718def msort(a):
3719 """
3720 Return a copy of an array sorted along the first axis.
3721
3722 .. deprecated:: 1.24
3723
3724 msort is deprecated, use ``np.sort(a, axis=0)`` instead.
3725
3726 Parameters
3727 ----------
3728 a : array_like
3729 Array to be sorted.
3730
3731 Returns
3732 -------
3733 sorted_array : ndarray
3734 Array of the same type and shape as `a`.
3735
3736 See Also
3737 --------
3738 sort
3739
3740 Notes
3741 -----
3742 ``np.msort(a)`` is equivalent to ``np.sort(a, axis=0)``.
3743
3744 Examples
3745 --------
3746 >>> a = np.array([[1, 4], [3, 1]])
3747 >>> np.msort(a) # sort along the first axis
3748 array([[1, 1],
3749 [3, 4]])
3750
3751 """
3752 # 2022-10-20 1.24
3753 warnings.warn(
3754 "msort is deprecated, use np.sort(a, axis=0) instead",
3755 DeprecationWarning,
3756 stacklevel=2,
3757 )
3758 b = array(a, subok=True, copy=True)
3759 b.sort(0)
3760 return b
3761
3762
3763def _ureduce(a, func, keepdims=False, **kwargs):

Callers 1

test_simpleMethod · 0.90

Calls 3

warnMethod · 0.80
sortMethod · 0.80
arrayFunction · 0.50

Tested by 1

test_simpleMethod · 0.72