Returns series of length k whose i-th entry is the recall in the top i

def recall_series(y_true, y_score, k=None, value=True):
    """
    Returns series of length k whose i-th entry is the recall in the top i
    """
    y_true, y_score = to_float(y_true, y_score)
    top = _argsort(y_score, k)

    if not value:
        y_true = 1-y_true

    a = np.nan_to_num(y_true[top]).cumsum()
    return pd.Series(a, index=np.arange(1, len(a)+1))