How to use the numbagg.decorators.groupndreduce 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 / grouped.py View on Github external
@groupndreduce(
    [
        (float32, int32, float32),
        (float32, int64, float32),
        (float64, int32, float64),
        (float64, int64, float64),
    ]
)
def group_nanmean(values, labels, out):
    counts = np.zeros(out.shape, dtype=labels.dtype)

    for indices in np.ndindex(values.shape):
        label = labels[indices]
        if label < 0:
            continue

        value = values[indices]