-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BENCH : Added benchmark for indexing with .loc for sorted/unsorted DatetimeIndex #43931
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
sonalprabhu
commented
Oct 8, 2021
•
edited
Loading
edited
- closes ASV: Add benchmark for indexing with .loc for sorted/unsorted DatetimeIndex #38690
@github-actions pre-commit |
@mzeitlin11 |
asv_bench/benchmarks/indexing.py
Outdated
@@ -247,15 +247,27 @@ class DatetimeIndexIndexing: | |||
def setup(self): | |||
dti = date_range("2016-01-01", periods=10000, tz="US/Pacific") | |||
dti2 = dti.tz_convert("UTC") | |||
dates = date_range("2011-1-1", periods=500000, freq="min") |
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.
To simplify/speed up construction, can we use the already constructed dti
on L248?
asv_bench/benchmarks/indexing.py
Outdated
dates = date_range("2011-1-1", periods=500000, freq="min") | ||
index = np.random.choice(dates, 500000, replace=True) | ||
df = DataFrame(index=index, data={"a": 1}) | ||
df_sorted = df.sort_index() |
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 you inline df
and df_sorted
?
asv_bench/benchmarks/indexing.py
Outdated
@@ -247,15 +247,27 @@ class DatetimeIndexIndexing: | |||
def setup(self): | |||
dti = date_range("2016-01-01", periods=10000, tz="US/Pacific") | |||
dti2 = dti.tz_convert("UTC") | |||
dates = date_range("2011-1-1", periods=500000, freq="min") | |||
index = np.random.choice(dates, 500000, replace=True) |
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.
To keep the naming consistent, maybe call this something like dti_unsorted
?
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 for the pr @sonalprabhu! Generally looks good, some small comments.
Can you also please post the results of running the benchmark so that we can make sure it's not too long?
This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this. |
pls merge master and update to comments |
@github-actions pre-commit |
@sonalprabhu can you merge master again. i think this PR is failing the asv's themselves, so pls test locally. |
Thanks for the PR but it appears to have gone stale. If interested in continuing please merge the main branch and address the failing benchmark and we can reopen. |