-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
API: ExtensionArray "serialize" and "from_serialized" methods for defining roundtripping behavior #25347
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
Comments
I don't quite follow the proposal. At least, I don't think the proposed behavior matches the names IIUC, the desire is for a pair of methods that will be called before and after a (NumPy?) numeric operation. Do we have examples other than datetime-tz?
How does |
"serialize" is a bit of a misnomer (just a placeholder name). Your follow-up examples are closer to the spirit of the idea.
|
this doesn't necessarily need a method on EA, maybe all we need are a pair of functions for internal use something like; we can use this when we need to go to a performant representation and back (e.g. pretty much anytime we use cython).
|
since _ndarray_values is gone, i think this is closeable |
we still need this general functionality though groupby, window, algos and nanops all do this |
We do it for datetimelike (though even that not really in window) but thats about it. there isnt a realistic way to do this for the general case |
It sounds like this use case isn't practical so closing. |
xref #25308 (comment)
When EAs go through cython routines, they need to be converted to numpy arrays (and dtypes) first and then recast to the correct EA. This recast may require specific logic. For example,
DatetimeTZDtype
s need to be localized to UTC first before applying the dtype.The proposal is for (optional) internal
_serialize
and_from_serialized
methods that defines specific recasting logic for the EA. @jreback proposed something like:Thoughts @jorisvandenbossche @TomAugspurger @jbrockmendel
The text was updated successfully, but these errors were encountered: