8000 PERF: ensure_string_array with non-numpy input array by topper-123 · Pull Request #37371 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

PERF: ensure_string_array with non-numpy input array #37371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 26, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PERF: ensure_string_array with non-numpy input array
  • Loading branch information
topper-123 committed Oct 26, 2020
commit a0c1ec0d277b091e093bbf1b0eff9b2d4f942b8b
1 change: 1 addition & 0 deletions pandas/_libs/lib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ cpdef ndarray[object] ensure_string_array(
cdef:
Py_ssize_t i = 0, n = len(arr)

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

if copy and result is arr:
Expand Down
0