Skip to content

Commit 3461db5

Browse files
authored
CLN: Use more memoryviews (#58330)
* Add memoryviews in reshape.pyx * Use more const memoryviews
1 parent 22e5247 commit 3461db5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pandas/_libs/lib.pyx

+3-3
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ def has_infs(const floating[:] arr) -> bool:
477477

478478
@cython.boundscheck(False)
479479
@cython.wraparound(False)
480-
def has_only_ints_or_nan(floating[:] arr) -> bool:
480+
def has_only_ints_or_nan(const floating[:] arr) -> bool:
481481
cdef:
482482
floating val
483483
intp_t i
@@ -631,7 +631,7 @@ ctypedef fused int6432_t:
631631

632632
@cython.wraparound(False)
633633
@cython.boundscheck(False)
634-
def is_range_indexer(ndarray[int6432_t, ndim=1] left, Py_ssize_t n) -> bool:
634+
def is_range_indexer(const int6432_t[:] left, Py_ssize_t n) -> bool:
635635
"""
636636
Perform an element by element comparison on 1-d integer arrays, meant for indexer
637637
comparisons
@@ -652,7 +652,7 @@ def is_range_indexer(ndarray[int6432_t, ndim=1] left, Py_ssize_t n) -> bool:
652652

653653
@cython.wraparound(False)
654654
@cython.boundscheck(False)
655-
def is_sequence_range(ndarray[int6432_t, ndim=1] sequence, int64_t step) -> bool:
655+
def is_sequence_range(const int6432_t[:] sequence, int64_t step) -> bool:
656656
"""
657657
Check if sequence is equivalent to a range with the specified step.
658658
"""

pandas/_libs/reshape.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ from pandas._libs.lib cimport c_is_list_like
1919

2020
@cython.wraparound(False)
2121
@cython.boundscheck(False)
22-
def unstack(numeric_object_t[:, :] values, const uint8_t[:] mask,
22+
def unstack(const numeric_object_t[:, :] values, const uint8_t[:] mask,
2323
Py_ssize_t stride, Py_ssize_t length, Py_ssize_t width,
2424
numeric_object_t[:, :] new_values, uint8_t[:, :] new_mask) -> None:
2525
"""
@@ -80,7 +80,7 @@ def unstack(numeric_object_t[:, :] values, const uint8_t[:] mask,
8080

8181
@cython.wraparound(False)
8282
@cython.boundscheck(False)
83-
def explode(ndarray[object] values):
83+
def explode(object[:] values):
8484
"""
8585
transform array list-likes to long form
8686
preserve non-list entries

0 commit comments

Comments
 (0)