當前位置: 首頁>>代碼示例>>Python>>正文


Python numeric.sort方法代碼示例

本文整理匯總了Python中numpy.core.numeric.sort方法的典型用法代碼示例。如果您正苦於以下問題:Python numeric.sort方法的具體用法?Python numeric.sort怎麽用?Python numeric.sort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在numpy.core.numeric的用法示例。


在下文中一共展示了numeric.sort方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: sort

# 需要導入模塊: from numpy.core import numeric [as 別名]
# 或者: from numpy.core.numeric import sort [as 別名]
def sort (x, axis = -1, fill_value=None):
    """If x does not have a mask, return a masked array formed from the
       result of numeric.sort(x, axis).
       Otherwise, fill x with fill_value. Sort it.
       Set a mask where the result is equal to fill_value.
       Note that this may have unintended consequences if the data contains the
       fill value at a non-masked site.

       If fill_value is not given the default fill value for x's type will be
       used.
    """
    if fill_value is None:
        fill_value = default_fill_value (x)
    d = filled(x, fill_value)
    s = fromnumeric.sort(d, axis)
    if getmask(x) is nomask:
        return masked_array(s)
    return masked_values(s, fill_value, copy=0) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:20,代碼來源:ma.py

示例2: argsort

# 需要導入模塊: from numpy.core import numeric [as 別名]
# 或者: from numpy.core.numeric import sort [as 別名]
def argsort (x, axis = -1, out=None, fill_value=None):
    """Treating masked values as if they have the value fill_value,
       return sort indices for sorting along given axis.
       if fill_value is None, use get_fill_value(x)
       Returns a numpy array.
    """
    d = filled(x, fill_value)
    return fromnumeric.argsort(d, axis) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:10,代碼來源:ma.py

示例3: argmax

# 需要導入模塊: from numpy.core import numeric [as 別名]
# 或者: from numpy.core.numeric import sort [as 別名]
def argmax (x, axis = -1, out=None, fill_value=None):
    """Treating masked values as if they have the value fill_value,
       return sort indices for maximum along given axis.
       if fill_value is None, use -get_fill_value(x) if it exists.
       Returns a numpy array if x has more than one dimension.
       Otherwise, returns a scalar index.
    """
    if fill_value is None:
        fill_value = default_fill_value (x)
        try:
            fill_value = - fill_value
        except:
            pass
    d = filled(x, fill_value)
    return fromnumeric.argmax(d, axis) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:17,代碼來源:ma.py


注:本文中的numpy.core.numeric.sort方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。