Skip to content

Commit bc66108

Browse files
committed
Fixed isnan reference issue on Windows
1 parent 04f1821 commit bc66108

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

pandas/_libs/groupby.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ from numpy cimport (ndarray,
1313
int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t,
1414
uint32_t, uint64_t, float32_t, float64_t)
1515

16-
from libc.math cimport isnan
1716
from libc.stdlib cimport malloc, free
1817

1918
from util cimport numeric, get_nat
@@ -26,6 +25,9 @@ cdef int64_t iNaT = get_nat()
2625
cdef double NaN = <double> np.NaN
2726
cdef double nan = NaN
2827

28+
cdef extern from "numpy/npy_math.h" nogil:
29+
bint npy_isnan(double x)
30+
2931
import missing
3032

3133

pandas/_libs/groupby_helper.pxi.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,8 @@ def group_rank_{{name}}(ndarray[float64_t, ndim=2] out,
535535
{{else}}
536536
if (i == N - 1 or (
537537
(masked_vals[_as[i]] != masked_vals[_as[i+1]]) and not
538-
(isnan(masked_vals[_as[i]]) and
539-
isnan(masked_vals[_as[i+1]])
538+
(npy_isnan(masked_vals[_as[i]]) and
539+
npy_isnan(masked_vals[_as[i+1]])
540540
))):
541541
{{endif}}
542542
dups = sum_ranks = 0

0 commit comments

Comments
 (0)