Skip to content

Commit e25a05d

Browse files
mzeitlin11feefladder
authored andcommitted
PERF: groupsort_indexer contiguity (pandas-dev#42031)
1 parent 520864a commit e25a05d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/_libs/algos.pyx

+3-3
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ def groupsort_indexer(const intp_t[:] index, Py_ssize_t ngroups):
217217
This is a reverse of the label factorization process.
218218
"""
219219
cdef:
220-
Py_ssize_t i, loc, label, n
221-
ndarray[intp_t] indexer, where, counts
220+
Py_ssize_t i, label, n
221+
intp_t[::1] indexer, where, counts
222222

223223
counts = np.zeros(ngroups + 1, dtype=np.intp)
224224
n = len(index)
@@ -241,7 +241,7 @@ def groupsort_indexer(const intp_t[:] index, Py_ssize_t ngroups):
241241
indexer[where[label]] = i
242242
where[label] += 1
243243

244-
return indexer, counts
244+
return indexer.base, counts.base
245245

246246

247247
cdef inline Py_ssize_t swap(numeric *a, numeric *b) nogil:

0 commit comments

Comments
 (0)