Skip to content

to_iso methods for DatetimeLikeArray #28180

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

Open
WillAyd opened this issue Aug 27, 2019 · 2 comments
Open

to_iso methods for DatetimeLikeArray #28180

WillAyd opened this issue Aug 27, 2019 · 2 comments
Labels
Datetime Datetime data dtype Enhancement IO JSON read_json, to_json, json_normalize Needs Discussion Requires discussion from core team before further action

Comments

@WillAyd
Copy link
Member

WillAyd commented Aug 27, 2019

to_json (and potentially others) handles the conversion of datetime-like objects to either epoch or isoformats depending on user input. All of this logic is currently housed in the objToJSON.c file and is a major reason why that extension module is rather complex / convoluted.

I think these methods may be general purpose enough to define in a vectorized manner on DatetimeLikeArrays. This wouldn't fully eliminate the need for the objToJSON.c extension module to define serialization for datetimes, timedelta and period object (as items stuck within an object array still need to be serialized), but it would definitely allow it to be more performant and move some of the logic out of the C layer back into Python

@jbrockmendel this is potentially also a precursor to #19486

@WillAyd WillAyd added Datetime Datetime data dtype IO JSON read_json, to_json, json_normalize Needs Discussion Requires discussion from core team before further action labels Aug 27, 2019
@mroeschke
Copy link
Member

mroeschke commented Aug 27, 2019

xref (I believe): #14772

@WillAyd
Copy link
Member Author

WillAyd commented Aug 27, 2019

Ah thanks for that. Should have searched :-) I'll update title to just be for ISO then which has slightly different requirements. I noticed there was a strftime documented at least on PeriodIndex which might be useful, though I don't think performance was all that great

@WillAyd WillAyd changed the title to_epoch and to_iso methods for DatetimeLikeArray to_iso methods for DatetimeLikeArray Aug 27, 2019
@WillAyd WillAyd mentioned this issue Oct 9, 2019
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Enhancement IO JSON read_json, to_json, json_normalize Needs Discussion Requires discussion from core team before further action
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants