Skip to content

Closes #5412: ArkoudaSeriesAccessor.locate materializes to pandas - #5455

Merged
ajpotts merged 1 commit into
Bears-R-Us:mainfrom
ajpotts:5412_ArkoudaSeriesAccessor.locate_materializes_to_pandas
Mar 5, 2026
Merged

ajpotts merged 1 commit into
Bears-R-Us:mainfrom
ajpotts:5412_ArkoudaSeriesAccessor.locate_materializes_to_pandas

Conversation

@ajpotts

@ajpotts ajpotts commented Mar 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR improves the efficiency of the Arkouda pandas extension Series accessor by avoiding an unnecessary round‑trip conversion when preserving the index returned from locate.

Previously, the implementation converted the Arkouda index to pandas and then wrapped it back into an Arkouda-backed index through ArkoudaIndexAccessor. This introduced redundant work and potential copies.

The new implementation replaces this logic with a direct helper that converts the Arkouda index to a pandas index without copying, preserving names and levels while reducing overhead.

Change

Replace the following code:

# Wrap result into an Arkouda-backed pandas Series
# (keep the returned index/name from the legacy result).
idx = ArkoudaIndexAccessor(out_ak.index.to_pandas()).to_ak()  # preserve names/levels

with:

idx = _ak_index_to_pandas_no_copy(out_ak.index)

Implementation Details

  • Added import:
    from ._index_accessor import _ak_index_to_pandas_no_copy
  • Replaced the previous ArkoudaIndexAccessor conversion with the new helper function.
  • The helper returns a pandas index view of the Arkouda index without forcing a copy.

Benefits

  • Eliminates unnecessary conversions.
  • Reduces overhead in Series accessor operations.
  • Simplifies the code path.
  • Maintains index metadata (names and levels).

Files Changed

  • arkouda/pandas/extension/_series_accessor.py

Closes #5412: ArkoudaSeriesAccessor.locate materializes to pandas

@ajpotts
ajpotts requested a review from jaketrookman March 5, 2026 16:44
@ajpotts
ajpotts force-pushed the 5412_ArkoudaSeriesAccessor.locate_materializes_to_pandas branch from 1ed76b4 to 673bcc7 Compare March 5, 2026 16:45
@ajpotts
ajpotts marked this pull request as ready for review March 5, 2026 16:50
@ajpotts
ajpotts enabled auto-merge March 5, 2026 17:31

@jaketrookman jaketrookman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@ajpotts
ajpotts added this pull request to the merge queue Mar 5, 2026
Merged via the queue into Bears-R-Us:main with commit 01c61e1 Mar 5, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ArkoudaSeriesAccessor.locate materializes to pandas

2 participants