Skip to content
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

ENH: Add dtype_backend parameter to to_datetime #53952

Open
1 of 3 tasks
wirable23 opened this issue Jun 30, 2023 · 6 comments
Open
1 of 3 tasks

ENH: Add dtype_backend parameter to to_datetime #53952

wirable23 opened this issue Jun 30, 2023 · 6 comments

Comments

@wirable23
Copy link

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

>>> a = pd.Series([4194304], dtype="int64[pyarrow]")
>>> pd.to_datetime(a).dtype
dtype('<M8[ns]')
>>>

In the above example, passing in a pyarrow backed series to to_datetime returns a numpy backed series, in to_numeric, there's a dtype_backend parameter that allows preserving of pyarrow dtypes, it would be nice to have the same option in to_datetime.

Feature Description

Same way as in to_numeric, adding a dtype_backend parameter.

Alternative Solutions

N/A

Additional Context

No response

@wirable23 wirable23 added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Jun 30, 2023
@phofl
Copy link
Member

phofl commented Jul 5, 2023

Yep this sounds good. Same as for to_numeric basically. Pinging @MarcoGorelli

@MarcoGorelli
Copy link
Member

sounds good - interested in submitting a pull request @wirable23 ?

@MarcoGorelli MarcoGorelli added Timeseries and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 6, 2023
@wirable23
Copy link
Author

@MarcoGorelli yes! The issue I was facing was that I didn't see arrow compute functions for some functionality of to_datetime, for example, pyarrow does not seem to have a compute function for creating datetimes from day month year components. Also, pyarrow does not support casting floating points to datetimes but there might be some other compute function that can be used.

@lithomas1 lithomas1 self-assigned this Oct 9, 2023
@ruimamaral
Copy link

@lithomas1 @wirable23 I see there haven't been any updates to this issue in a while.
If you're both okay with it, I would like to implement this functionality.
Thanks!

@lithomas1 lithomas1 removed their assignment Apr 29, 2024
@lithomas1
Copy link
Member

Go for it.

@ruimamaral
Copy link

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants