-
Notifications
You must be signed in to change notification settings - Fork 97
Closes #5219: improve astype in ak.pandas.extension #5222
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
base: main
Are you sure you want to change the base?
Closes #5219: improve astype in ak.pandas.extension #5222
Conversation
f7d1dfc to
1935bed
Compare
1935bed to
f378f3d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5222 +/- ##
========================================
Coverage ? 100.00%
========================================
Files ? 4
Lines ? 63
Branches ? 0
========================================
Hits ? 63
Misses ? 0
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f378f3d to
f023951
Compare
8731d2d to
28111d6
Compare
drculhane
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks solid and straightforward.
arkouda/numpy/_typing/_typing.py
Outdated
| # accept the spellings you want to map to Arkouda Strings | ||
| return x in ("str", "str_") or x is str_ or x is str_ or x is Strings | ||
| return ( | ||
| (isinstance(x, str) and x.lower() in ("str", "str_", "string", "trings")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is "trings" a typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
28111d6 to
b1ab121
Compare
Improve
astypesemantics across Arkouda pandas ExtensionArraysSummary
This PR implements fully-featured, pandas-compatible
astypebehavior for all Arkouda-backed pandas ExtensionArrays:ArkoudaArrayArkoudaCategoricalArrayArkoudaStringArrayThe implementation aligns with pandas’
ExtensionArray.astypecontract, avoids unnecessary NumPy fallbacks, and consistently returns Arkouda-backed ExtensionArrays whenever possible.In addition, this PR:
mypy"string"support)ExtensionDtypecastingKey Changes
Correct, consistent
astypebehaviorobject→ always returns NumPycopy=False→ returns selfcategory→ stays categoricalstring→ArkoudaStringArrayArkoudaStringArrayRuntimeError(documented and tested)Pandas compatibility & typing
@overloadsignatures matching pandasExtensionArray.astypemypyoverride and return-type errorsTests
New test coverage includes:
ExtensionDtypetargets (pd.Int64Dtype,pd.StringDtype, etc.)Why this matters
astypeCloses #5219: improve astype in ak.pandas.extension