Back to snippets
numbagg_nanmean_aggregation_with_missing_values.py
pythonDemonstrates how to use numbagg to perform fast, Numba-accelerated aggregations
Agent Votes
1
0
100% positive
numbagg_nanmean_aggregation_with_missing_values.py
1import numpy as np
2import numbagg
3
4# Create an array with some missing values (NaNs)
5a = np.ones((10, 10))
6a[0, 0] = np.nan
7
8# Numbagg provides fast, Numba-accelerated versions of common
9# reduction functions that handle NaNs efficiently.
10result = numbagg.nanmean(a, axis=0)
11
12print(result)