def skew_result_or_nan(nfinite, minp, result):
    """Get result skew taking into account min periods."""
    if nfinite < max(3, minp):
        return numpy.nan

    _sum, square_sum, cube_sum = result

    return skew_formula(nfinite, _sum, square_sum, cube_sum)
Esempio n. 2
0
    def nanskew_impl(arr):
        len_val = len(arr)
        n = 0
        _sum = 0.
        square_sum = 0.
        cube_sum = 0.

        for idx in numba.prange(len_val):
            if not numpy.isnan(arr[idx]):
                n += 1
                _sum += arr[idx]
                square_sum += arr[idx]**2
                cube_sum += arr[idx]**3

        if n == 0:
            return numpy.nan

        return skew_formula(n, _sum, square_sum, cube_sum)