Repository navigation
Closes #4597: implement pandas ExtensionArray for arkouda - #4598
Merged
Merged
Conversation
Contributor
Author
|
Examples showing it working: In [2]: data = ArkoudaArray(ak.array([1,2,3]))
...: s = pd.Series(data)
...: s
Out[2]:
0 1
1 2
2 3
dtype: arkouda
In [3]:
...: type(s)
...:
Out[3]: pandas.core.series.Series
In [4]: df = pd.DataFrame({"col1": ArkoudaArray(ak.arange(5)), "col2": ArkoudaArray(ak.arange(5)*2)})
...: df
Out[4]:
col1 col2
0 0 0
1 1 2
2 2 4
3 3 6
4 4 8
In [5]: type(df)
Out[5]: pandas.core.frame.DataFrame
In [6]: # Indexing
...: s[:2]
Out[6]:
0 1
1 2
dtype: arkouda
In [7]: # Joins
...: df2 = pd.DataFrame({"col1": ArkoudaArray(ak.arange(5)*3), "col3": ArkoudaArray(ak.arange(5)*2)})
...: df.merge(df2, on="col1", how="inner")
Out[7]:
col1 col2 col3
0 0 0 0
1 3 6 2
In [8]: df.iloc[1:3]
Out[8]:
col1 col2
1 1 2
2 2 4
|
ajpotts
force-pushed
the
extension_array
branch
2 times, most recently
from
June 16, 2025 19:30
afb39bc to
7315ba4
Compare
ajpotts
force-pushed
the
extension_array
branch
5 times, most recently
from
August 11, 2025 21:05
d6d2928 to
056feba
Compare
ajpotts
marked this pull request as ready for review
August 11, 2025 21:05
ajpotts
force-pushed
the
extension_array
branch
from
August 12, 2025 17:53
056feba to
4264890
Compare
drculhane
approved these changes
Aug 20, 2025
Contributor
There was a problem hiding this comment.
Okay, in some degree of detail, here we go:
You've added four classes. ArkoudaBaseArray inherits from the pandas ExtensionArray. ArkoudaArray, ArkoudaCategoricalArray and ArkoudaStringArray all inherit from both ArkoudaBaseArray and ExtensionArray. In each case, some methods have been redefined.
So far, only ArkoudaArray has more than docstring tests in the test file.
The _arkouda_array.py test file appears to cover all of the redefined methods. I have a few observations:
- I'd rather the nbytes test checked against a value, rather than just >0
- Somewhat similar comment about the reduce test. It seems to only be checking that the reduction operations happened, not what the results were.
- In test_factorize, checking against the set of codes loses some information. Imo, it would be better to check that codes = [0,1,0,2], rather than set(code) = {0,1,2}.
- It doesn't seem to me that _from_factorized is actually given factorized input. By that, I mean it's given the unique values, but nothing corresponding to codes. Now if that was the intent (i.e., "from_factorized" means "no repeated values") then never mind.
Since you've described this as a work in progress, and since all the tests in tests/pandas/extension/arkouda_array.py pass, I'm inclined to approve it as is.
ajpotts
force-pushed
the
extension_array
branch
from
August 20, 2025 19:04
4264890 to
3756f44
Compare
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 introduces experimental support for using Arkouda arrays as pandas
ExtensionArrays, enabling seamless integration with pandasSeries,DataFrame, andIndexoperations.Key Features
✅
ArkoudaArray,ArkoudaStringArray, andArkoudaCategoricalArraynow implement theExtensionArrayinterface.✅ Corresponding
ArkoudaDtype,ArkoudaStringDtype, andArkoudaCategoricalDtypeclasses added and registered.✅ Basic support for:
Element-wise operations and reductions
Slicing, indexing, and take
SeriesandDataFrameconstructionJoins and merges via
_concat_same_typeIndexandMultiIndexcompatibility (partial)✅ Unit tests for Series behavior and join operations
Implementation Notes
_concat_same_typeis attached to each Arkouda-backed array class to support join operations.A shared
BaseArkoudaArrayclass factors out common logic for take, slicing, and equality.Some limitations and fallbacks are documented where full pandas interoperability isn't yet available.
This work brings Arkouda one step closer to being a drop-in backend for pandas workflows at scale. It allows developers to write familiar pandas code while executing at scale on distributed memory systems.
Closes #4597: implement pandas ExtensionArray for arkouda