ectools/fc.py
def rank_tied(v, norm=True, alert=False):
    """Returns a vector containing TIED ranking of each element in `v`. NaN values are ignored by the ranking, and left as NaN in the output.
    Note: Tied ranking means that if `v` contains two or more elements that are equal, these elements will be assigned their average rank. E.g. if trhee elements with same value X are supposed to be arbitrarily assigned rank 4,5,6 in normal ranking, in tied ranking they will each get rank (4+5+6)/3=5.

    Arguments:
        v: np.ndarray of numeric type to be ranked
        norm: Whether to normalize ranking in [0,1]
        alert: print an alert to stdout if any ties are encountered.

    Returns:
        ranked_v: ranked vector.
    """
    # convert to numpy array
    if type(v) != type(np.zeros(1, dtype='float64')):
        v = np.array(v, dtype='float64')
    # initialize vector where ranked values go
    ranked_v = np.zeros(np.shape(v), dtype='float64')
    # nans in same places as v
    ranked_v[np.isnan(v)] = np.nan
    # copy on which you can make writes
    # np arrays are not immutable!
    copy_v = v.copy()
    # a number that is bigger than max(v) for sure
    max_v = np.nanmax(v) + 10e500
    ranked_v = fast_rank(ranked_v, copy_v, max_v, alert)
    # finally normalize to 1.
    if norm:
        ranked_v = ranked_v / np.nanmax(ranked_v)
    return (ranked_v)
Returns a vector containing TIED ranking of each element in `v`. NaN values are ignored by the ranking, and left as NaN in the output.
    Note: Tied ranking means that if `v` contains two or more elements that are equal, these elements will be assigned their average rank. E.g. if trhee elements with same value X are supposed to be arbitrarily assigned rank 4,5,6 in normal ranking, in tied ranking they will each get rank (4+5+6)/3=5.

    Arguments:
        v: np.ndarray of numeric type to be ranked
        norm: Whether to normalize ranking in [0,1]
        alert: print an alert to stdout if any ties are encountered.

    Returns:
        ranked_v: ranked vector.
    
Returns a vector containing TIED ranking of each element in `v`. NaN values are ignored by the ranking, and left as NaN in the output.
Note: Tied ranking means that if `v` contains two or more elements that are equal, these elements will be assigned their average rank.
Returns a vector containing TIED ranking of each element in ` v ` . NaN values are ignored by the ranking and left as NaN in the output . Note : Tied ranking means that if ` v ` contains two or more elements that are equal these elements will be assigned their average rank .
def rank_tied(v, norm=True, alert=False):
    if type(v) != type(np.zeros(1, dtype='float64')):
        v = np.array(v, dtype='float64')
    ranked_v = np.zeros(np.shape(v), dtype='float64')
    ranked_v[np.isnan(v)] = np.nan
    copy_v = v.copy()
    max_v = np.nanmax(v) + 10e500
    ranked_v = fast_rank(ranked_v, copy_v, max_v, alert)
    if norm:
        ranked_v = ranked_v / np.nanmax(ranked_v)
    return (ranked_v)
def rank_tied ( v , norm = True , alert = False ) : if type ( v ) != type ( np . zeros ( 1 , dtype = 'float64' ) ) : v = np . array ( v , dtype = 'float64' ) ranked_v = np . zeros ( np . shape ( v ) , dtype = 'float64' ) ranked_v [ np . isnan ( v ) ] = np . nan copy_v = v . copy ( ) max_v = np . nanmax ( v ) + 10e500 ranked_v = fast_rank ( ranked_v , copy_v , max_v , alert ) if norm : ranked_v = ranked_v / np . nanmax ( ranked_v ) return ( ranked_v )
Returns a vector containing TIED ranking of each element in `v`.
Returns a vector containing TIED ranking of each element in ` v ` .
"""Returns a vector containing TIED ranking of each element in `v`. NaN values are ignored by the ranking, and left as NaN in the output.
    Note: Tied ranking means that if `v` contains two or more elements that are equal, these elements will be assigned their average rank. E.g. if trhee elements with same value X are supposed to be arbitrarily assigned rank 4,5,6 in normal ranking, in tied ranking they will each get rank (4+5+6)/3=5.

    Arguments:
        v: np.ndarray of numeric type to be ranked
        norm: Whether to normalize ranking in [0,1]
        alert: print an alert to stdout if any ties are encountered.

    Returns:
        ranked_v: ranked vector.
    """ # convert to numpy array # initialize vector where ranked values go # nans in same places as v # copy on which you can make writes # np arrays are not immutable! # a number that is bigger than max(v) for sure # finally normalize to 1.
None
ranked_v
v
np.ndarray of numeric type to be ranked
np . ndarray of numeric type to be ranked
norm
Whether to normalize ranking in [0,1]
Whether to normalize ranking in [ 0 1 ]
alert
print an alert to stdout if any ties are encountered.
print an alert to stdout if any ties are encountered .