(nfinite, minp, result)
return cov_xy / numpy.sqrt(var_x * var_y)
Get result corr taking into account min periods.
Get result corr taking into account min periods.
Get result corr taking into account min periods .
def corr_result_or_nan(nfinite, minp, result):
    """Get result corr taking into account min periods."""
    if nfinite < max(1, minp):
        return numpy.nan

    sum_x, sum_y, sum_xy, sum_xx, sum_yy = result

    var_x = sum_xx - sum_x * sum_x / nfinite
    if _almost_equal(var_x, 0.):
        return numpy.nan

    var_y = sum_yy - sum_y * sum_y / nfinite
    if _almost_equal(var_y, 0.):
        return numpy.nan

    cov_xy = sum_xy - sum_x * sum_y / nfinite

    return cov_xy / numpy.sqrt(var_x * var_y)
def corr_result_or_nan ( nfinite , minp , result ) : if nfinite < max ( 1 , minp ) : return numpy . nan sum_x , sum_y , sum_xy , sum_xx , sum_yy = result var_x = sum_xx - sum_x * sum_x / nfinite if _almost_equal ( var_x , 0. ) : return numpy . nan var_y = sum_yy - sum_y * sum_y / nfinite if _almost_equal ( var_y , 0. ) : return numpy . nan cov_xy = sum_xy - sum_x * sum_y / nfinite return cov_xy / numpy . sqrt ( var_x * var_y )