Skip to content

Commit a0186ea

Browse files
committed
TST: fancy_inc Cython function
1 parent 1d92503 commit a0186ea

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/src/sandbox.pyx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,18 @@ def get_indexer(ndarray values, dict mapping):
146146
return fill_vec
147147

148148

149+
@cython.wraparound(False)
150+
@cython.boundscheck(False)
151+
def fancy_inc(ndarray[int64_t, ndim=2] values,
152+
ndarray[int64_t] iarr, ndarray[int64_t] jarr, int64_t inc):
153+
cdef:
154+
Py_ssize_t i, n = len(iarr)
155+
156+
for i in range(n):
157+
values[iarr[i], jarr[i]] += inc
158+
159+
160+
149161
# def foo2(o):
150162
# return util.is_integer_object(o)
151163

0 commit comments

Comments
 (0)