-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
PERF: making DatetimeIndex.date more performant #18058
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
Labels
Milestone
Comments
Here are the changes made following the steps outlined above. In datetimes.py:
In tslib.pyx, I added a method to create the date objects, a check for the function to use and consider tz
A quick comparison using timeit:
|
if you would put this in a PR we can have a look |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
We can substantially speed up
DatetimeIndex.date
with a small tweak in the code, from SOso [47] and [48] are almost the same, the difference is
datetime
for [47] anddate
for [48].If we allowed
ints_to_pydatetime
to createdate
objects (just needs a simple function pointer) around https://github.com/pandas-dev/pandas/blob/master/pandas/_libs/tslib.pyx#L140, then this would work, IOWwhere
.to_pydate()
is basically.to_pydatetime()
but adding an additional arg, saykind='date'
, whichints_to_pydatetime
would handle (and createdate
rather thandatetime
).This bypasses the iteration which creates many python objects.
The text was updated successfully, but these errors were encountered: