Repository navigation
Closes #5428: BUG: Pandas Series with dtype=ak Returns NumPy Index Values - #5435
Merged
ajpotts merged 1 commit intoFeb 24, 2026
Conversation
ajpotts
marked this pull request as ready for review
February 24, 2026 19:17
ajpotts
enabled auto-merge
February 24, 2026 19:18
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 improves Arkouda’s pandas-extension interoperability in two areas:
RangeIndex conversion is now server-side.
_pandas_index_to_akdetectspandas.RangeIndexand constructs the corresponding index directly on the Arkouda server viaak_arange, avoiding client-side materialization for very large ranges.Series.ak.is_arkoudais now “fully Arkouda-backed”.The predicate now returns
Trueonly when both:ArkoudaExtensionArray, andMultiIndex, all levels are Arkouda-backed).Motivation
RangeIndexis “virtual” (start/stop/step). Any conversion path that materializes its values on the client can blow up memory for huge ranges. Creating the range directly on the server avoids this footgun.Series.ak.is_arkoudacould return misleading results by relying on.index.values, which is frequently a NumPy array even when the index is conceptually virtual or otherwise not truly Arkouda-backed. The updated logic checksidx.array(and MultiIndex levels) and better matches the meaning of “Arkouda-backed.”User-visible behavior changes
_pandas_index_to_akpd.RangeIndexis converted via server-sideak_arange(...)and wrapped inak.Index.RangeIndexwithstep == 0raisesValueError.Series.ak.is_arkoudaTrueonly when both data and index are Arkouda-backed.pd.MultiIndex, requires each level to be Arkouda-backed.Implementation notes
_pandas_index_to_ak:pd.MultiIndexas before (delegates toak.MultiIndex).pd.RangeIndexto build values server-side usingak_arange(stop)for the common(start=0, step=1)case, otherwiseak_arange(start, stop, step).Series.ak.is_arkouda:Falseif the Series values are not anArkoudaExtensionArray..array(and each MultiIndex level.array) using a defensivegetattr(..., None).Tests added
Index accessor tests (
tests/pandas/extension/index_accessor.py)test_pandas_index_to_ak_rangeindex_default_roundtripstest_pandas_index_to_ak_rangeindex_nontrivial_roundtripstest_pandas_index_to_ak_rangeindex_negative_step_roundtrips_or_errorsSeries accessor tests (
tests/pandas/extension/series_accessor.py)test_is_arkouda_true_for_to_ak_series_with_default_rangeindextest_is_arkouda_true_for_to_ak_series_with_nontrivial_indextest_is_arkouda_true_for_to_ak_series_with_multiindexHow to validate
pytest -q tests/pandas/extension/index_accessor.pypytest -q tests/pandas/extension/series_accessor.pyNotes / follow-ups
arange, the test accepts a clear exception. If negative steps should be supported, we can tighten the expectation to require round-tripping.Closes #5428: BUG: Pandas Series with dtype=ak Returns NumPy Index Values