File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 77
88from typing import TYPE_CHECKING
99import warnings
10+ from inspect import signature
1011
1112import numpy as np
1213
1314from pandas ._libs import missing as libmissing
1415
15- from pandas .core .nanops import check_below_min_count
16+ from pandas .core .nanops import check_below_min_count , _USE_NUMBA , nanops_numba
1617
1718if TYPE_CHECKING :
1819 from collections .abc import Callable
@@ -51,6 +52,14 @@ def _reductions(
5152 ``min_count`` non-NA values are present the result will be NA.
5253 axis : int, optional, default None
5354 """
55+ if _USE_NUMBA :
56+ nanop = getattr (nanops_numba , f"nan{ func .__name__ } " , None )
57+ if nanop is not None :
58+ kwargs = dict (mask = mask , skipna = skipna , axis = axis )
59+ if "min_count" in signature (nanop ).parameters :
60+ kwargs ["min_count" ] = min_count
61+ return nanop (values , ** kwargs )
62+
5463 if not skipna :
5564 if mask .any () or check_below_min_count (values .shape , None , min_count ):
5665 return libmissing .NA
You can’t perform that action at this time.
0 commit comments