Skip to content

Commit e3337aa

Browse files
authored
MAINT: remove from numpy.math cimport usages (#52544)
These are available from Cython's `libc`, which is cleaner. NumPy would like to get rid of shipping libnpymath, and has also deprecated the (unrelated) `numpy.math` in the Python API. So best to not use it from Cython either.
1 parent 5b66502 commit e3337aa

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

pandas/_libs/groupby.pyx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ from cython cimport (
33
Py_ssize_t,
44
floating,
55
)
6-
from libc.math cimport sqrt
6+
from libc.math cimport (
7+
NAN,
8+
sqrt,
9+
)
710
from libc.stdlib cimport (
811
free,
912
malloc,
@@ -24,7 +27,6 @@ from numpy cimport (
2427
uint8_t,
2528
uint64_t,
2629
)
27-
from numpy.math cimport NAN
2830

2931
cnp.import_array()
3032

pandas/_libs/reshape.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ from numpy cimport (
99
import numpy as np
1010

1111
cimport numpy as cnp
12-
from numpy.math cimport NAN
12+
from libc.math cimport NAN
1313

1414
cnp.import_array()
1515

pandas/_libs/sparse.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ cimport cython
33
import numpy as np
44

55
cimport numpy as cnp
6+
from libc.math cimport (
7+
INFINITY as INF,
8+
NAN as NaN,
9+
)
610
from numpy cimport (
711
float64_t,
812
int8_t,
@@ -11,10 +15,6 @@ from numpy cimport (
1115
ndarray,
1216
uint8_t,
1317
)
14-
from numpy.math cimport (
15-
INFINITY as INF,
16-
NAN as NaN,
17-
)
1818

1919
cnp.import_array()
2020

0 commit comments

Comments
 (0)