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

PERF: RangeIndex.append returns a RangeIndex when possible #57467

Merged
merged 10 commits into from Mar 6, 2024

Conversation

mroeschke
Copy link
Member

Discovered in #57441

@mroeschke mroeschke added the Index Related to the Index class or subclasses label Feb 17, 2024
@mroeschke mroeschke added this to the 3.0 milestone Feb 22, 2024
@datapythonista
Copy link
Member

This looks good, do you want to fix the conflict here @mroeschke

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, added an idea for a test, but either way looks good.

Comment on lines +612 to +614
ri = RangeIndex(1)
result = ri.append(Index([1]))
expected = RangeIndex(2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you think it can be useful to also add a test for the case where it can't return a RangeIndex but an Index maybe we can add it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea; I think that would be useful. Added a test in the latest commit

@mroeschke mroeschke merged commit 812a996 into pandas-dev:main Mar 6, 2024
47 checks passed
@mroeschke mroeschke deleted the perf/ri/_concat_more branch March 6, 2024 21:15
pmhatre1 pushed a commit to pmhatre1/pandas-pmhatre1 that referenced this pull request May 7, 2024
…v#57467)

* PERF: RangeIndex.append returns a RangeIndex when possible

* add correct issue number

* add correct issue number

* Only if int

* Guard on integer dtype kind

* Add test for return Index case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Index Related to the Index class or subclasses
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants