Skip to content

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

Closed
wants to merge 5 commits into from

Conversation

sonalprabhu
Copy link

@sonalprabhu sonalprabhu commented Oct 8, 2021

@sonalprabhu
Copy link
Author

@github-actions pre-commit

@sonalprabhu
Copy link
Author

@mzeitlin11
Please review the PR

@@ -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")
Copy link
Member

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?

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()
Copy link
Member

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?

@@ -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)
Copy link
Member

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?

Copy link
Member

@mzeitlin11 mzeitlin11 left a 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?

@mzeitlin11 mzeitlin11 added Benchmark Performance (ASV) benchmarks Indexing Related to indexing on series/frames, not to indexes themselves Datetime Datetime data dtype labels Oct 9, 2021
@mzeitlin11 mzeitlin11 added this to the 1.4 milestone Oct 9, 2021
@pandas-dev pandas-dev deleted a comment from pep8speaks Oct 9, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2021

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.

@github-actions github-actions bot added the Stale label Nov 9, 2021
@jreback
Copy link
Contributor

jreback commented Nov 14, 2021

pls merge master and update to comments

@sonalprabhu
Copy link
Author

@github-actions pre-commit

@jreback
Copy link
Contributor

jreback commented Nov 28, 2021

@sonalprabhu can you merge master again. i think this PR is failing the asv's themselves, so pls test locally.

@jreback jreback removed this from the 1.4 milestone Dec 24, 2021
@mroeschke
Copy link
Member

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.

@mroeschke mroeschke closed this Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Benchmark Performance (ASV) benchmarks Datetime Datetime data dtype Indexing Related to indexing on series/frames, not to indexes themselves Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ASV: Add benchmark for indexing with .loc for sorted/unsorted DatetimeIndex
4 participants