How to use the numbagg.decorators.ndmovingexp function in numbagg

To help you get started, we’ve selected a few numbagg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shoyer / numbagg / numbagg / moving.py View on Github external
@ndmovingexp([(float32[:], float32, float32[:]), (float64[:], float64, float64[:])])
def move_exp_nanmean(a, alpha, out):

    N = len(a)
    if N == 0:
        return

    old_wt_factor = 1.0 - alpha
    new_wt = 1.0
    ignore_na = False  # could add as option in the future

    weighted_avg = a[0]
    is_observation = not np.isnan(weighted_avg)
    nobs = int(is_observation)
    out[0] = weighted_avg
    old_wt = 1.0