File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,9 @@ cdef extern from "Python.h":
7
7
Py_ssize_t PY_SSIZE_T_MAX
8
8
9
9
import numpy as np
10
- from numpy cimport int64_t
10
+ cimport numpy as cnp
11
+ from numpy cimport NPY_INT64, int64_t
12
+ cnp.import_array()
11
13
12
14
from pandas._libs.algos import ensure_int64
13
15
@@ -105,7 +107,9 @@ cdef class BlockPlacement:
105
107
Py_ssize_t start, stop, end, _
106
108
if not self ._has_array:
107
109
start, stop, step, _ = slice_get_indices_ex(self ._as_slice)
108
- self ._as_array = np.arange(start, stop, step, dtype = np.int64)
110
+ # NOTE: this is the C-optimized equivalent of
111
+ # np.arange(start, stop, step, dtype=np.int64)
112
+ self ._as_array = cnp.PyArray_Arange(start, stop, step, NPY_INT64)
109
113
self ._has_array = True
110
114
return self ._as_array
111
115
You can’t perform that action at this time.
0 commit comments