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 7
7
8
8
from typing import TYPE_CHECKING
9
9
import warnings
10
+ from inspect import signature
10
11
11
12
import numpy as np
12
13
13
14
from pandas ._libs import missing as libmissing
14
15
15
- from pandas .core .nanops import check_below_min_count
16
+ from pandas .core .nanops import check_below_min_count , _USE_NUMBA , nanops_numba
16
17
17
18
if TYPE_CHECKING :
18
19
from collections .abc import Callable
@@ -51,6 +52,14 @@ def _reductions(
51
52
``min_count`` non-NA values are present the result will be NA.
52
53
axis : int, optional, default None
53
54
"""
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
+
54
63
if not skipna :
55
64
if mask .any () or check_below_min_count (values .shape , None , min_count ):
56
65
return libmissing .NA
You can’t perform that action at this time.
0 commit comments