-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
ENH: Allow dt accessor when using ArrowDtype with datetime types #50954
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
Conversation
| Any other comments here @jbrockmendel ? |
| will take another look |
| Callable to map the delegate's function to the cls' function. | ||
| raise_on_missing: bool, default True | ||
| Raise if an accessor does not exist on delegate. | ||
| False skips the missing accessor. |
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.
do you expect to reuse this machinery again? if not, could the pyarrow-dt be accessor be implemented standalone to avoid making this more complicaed?
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.
I am hoping to use this for the pyarrow duration types as well.
I think a standalone implementation would require a further refactoring of this dt accessor. Looks like currently datetime and timedelta dispatch to the Index while we probably need something that dispatches to the array
pandas/core/indexes/accessors.py Outdated
| index=orig.index, | ||
| ) | ||
| | ||
| if isinstance(data.dtype, ArrowDtype) and data.dtype.kind in "mM": |
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 it "mM" or just "M"?
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.
Thanks yeah this should be "M" until pa.duration is supported
| fget=_getter, fset=_setter, doc=getattr(delegate, name).__doc__ | ||
| fget=_getter, | ||
| fset=_setter, | ||
| doc=getattr(delegate, accessor_mapping(name)).__doc__, |
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.
can we do this once near the top?
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.
ill put this into my next Assorted Cleanups branch
jbrockmendel 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.
LGTM pending green
Enabled & tested for
pa.timestamptypes so far. Will follow up withpa.durationtypes in a subsequent PR