Repository navigation
Closes #5419: Bug: DataFrame.ak.to_ak() Does Not Convert Index to Arkouda-Backed Index - #5420
Merged
Conversation
…dex to Arkouda-Backed Index
ajpotts
force-pushed
the
5419_Bug_DataFrame.ak.to_ak_Does_Not_Convert_Index_to_Arkouda-Backed_Index
branch
from
February 19, 2026 11:37
bfb670a to
4a56aee
Compare
ajpotts
marked this pull request as ready for review
February 19, 2026 13:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes an architectural inconsistency in
DataFrame.ak.to_ak()where:
ExtensionArraysRangeIndexThis broke Arkouda's zero-copy invariants and resulted in mixed backend
state (Arkouda-backed columns with NumPy-backed index).
This PR ensures the index is converted to an Arkouda-backed pandas
IndexusingArkoudaIndexAccessor.Problem
Before this change:
The index was silently replaced with a default
RangeIndexbecauseto_ak()rebuilt the DataFrame without passing an index:This caused: - Mixed backend state - Violation of Arkouda zero-copy
guarantees - Potential downstream inconsistencies in index-aware
operations
Changes
1. Convert Index via
ArkoudaIndexAccessorThis reuses the existing index conversion infrastructure and keeps
behavior consistent with:
_index_accessor.pySeries.ak.to_ak()2. Avoid Re-materializing Already Arkouda-Backed Columns
If a column is already Arkouda-backed, reuse it instead of calling
ak.array()again:This preserves zero-copy behavior and improves performance.
New Test
Added regression test:
Verifies:
Architectural Impact
This change restores the invariant:
No behavior changes for users except increased correctness and
consistency.
Performance Impact
columns
Backwards Compatibility
Fully backwards compatible.
Only fixes inconsistent backend state.
Closes #5419: Bug: DataFrame.ak.to_ak() Does Not Convert Index to Arkouda-Backed Index