Skip to content

Commit a5112c2

Browse files
committed
fix some cython 3 todos
1 parent d34b82c commit a5112c2

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

pandas/_libs/algos.pyx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,8 +1089,7 @@ cdef void rank_sorted_1d(
10891089
float64_t[::1] out,
10901090
int64_t[::1] grp_sizes,
10911091
const intp_t[:] sort_indexer,
1092-
# TODO(cython3): make const (https://github.com/cython/cython/issues/3222)
1093-
numeric_object_t[:] masked_vals,
1092+
const numeric_object_t[:] masked_vals,
10941093
const uint8_t[:] mask,
10951094
bint check_mask,
10961095
Py_ssize_t N,
@@ -1378,16 +1377,15 @@ ctypedef fused out_t:
13781377
@cython.boundscheck(False)
13791378
@cython.wraparound(False)
13801379
def diff_2d(
1381-
ndarray[diff_t, ndim=2] arr, # TODO(cython3) update to "const diff_t[:, :] arr"
1380+
const diff_t[:, :] arr,
13821381
ndarray[out_t, ndim=2] out,
13831382
Py_ssize_t periods,
13841383
int axis,
13851384
bint datetimelike=False,
13861385
):
13871386
cdef:
13881387
Py_ssize_t i, j, sx, sy, start, stop
1389-
bint f_contig = arr.flags.f_contiguous
1390-
# bint f_contig = arr.is_f_contig() # TODO(cython3) once arr is memoryview
1388+
bint f_contig = arr.is_f_contig()
13911389
diff_t left, right
13921390

13931391
# Disable for unsupported dtype combinations,

pandas/_libs/groupby.pyx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,14 +1435,12 @@ cdef inline void _check_below_mincount(
14351435
out[i, j] = 0
14361436

14371437

1438-
# TODO(cython3): GH#31710 use memorviews once cython 0.30 is released so we can
1439-
# use `const numeric_object_t[:, :] values`
14401438
@cython.wraparound(False)
14411439
@cython.boundscheck(False)
14421440
def group_last(
14431441
numeric_object_t[:, ::1] out,
14441442
int64_t[::1] counts,
1445-
ndarray[numeric_object_t, ndim=2] values,
1443+
const numeric_object_t[:, :] values,
14461444
const intp_t[::1] labels,
14471445
const uint8_t[:, :] mask,
14481446
uint8_t[:, ::1] result_mask=None,
@@ -1502,14 +1500,12 @@ def group_last(
15021500
)
15031501

15041502

1505-
# TODO(cython3): GH#31710 use memorviews once cython 0.30 is released so we can
1506-
# use `const numeric_object_t[:, :] values`
15071503
@cython.wraparound(False)
15081504
@cython.boundscheck(False)
15091505
def group_nth(
15101506
numeric_object_t[:, ::1] out,
15111507
int64_t[::1] counts,
1512-
ndarray[numeric_object_t, ndim=2] values,
1508+
const numeric_object_t[:, :] values,
15131509
const intp_t[::1] labels,
15141510
const uint8_t[:, :] mask,
15151511
uint8_t[:, ::1] result_mask=None,

0 commit comments

Comments
 (0)