Skip to content

Commit 76b5764

Browse files
committed
PERF: ensure_string_array with non-numpy input array
1 parent c0c3516 commit 76b5764

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

pandas/_libs/lib.pyx

+1
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,7 @@ cpdef ndarray[object] ensure_string_array(
651651
cdef:
652652
Py_ssize_t i = 0, n = len(arr)
653653

654+
arr = np.asarray(arr) # PERF: need a numpy array to ensure fast access
654655
result = np.asarray(arr, dtype="object")
655656

656657
if copy and result is arr:

0 commit comments

Comments
 (0)