8000 PERF: Do not init cache in RangeIndex.take by GianlucaFicarelli · Pull Request #53397 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

PERF: Do not init cache in RangeIndex.take #53397

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

Merged
merged 9 commits into from
Jul 18, 2023
Prev Previous commit
Next Next commit
Add test_take_when_index_has_negative_step
  • Loading branch information
GianlucaFicarelli committed Jul 14, 2023
commit cf37945596ca7c6bbf6eeb65a158e2ebe7f732b2
6 changes: 6 additions & 0 deletions pandas/tests/indexes/ranges/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ def test_take_when_index_has_step(self):
expected = Index([4, 1, 10, 1], dtype=np.int64, name="foo")
tm.assert_index_equal(result, expected)

def test_take_when_index_has_negative_step(self):
idx = RangeIndex(11, -4, -2, name="foo") # [11, 9, 7, 5, 3, 1, -1, -3]
result = idx.take(np.array([1, 0, -1, -8]))
expected = Index([9, 11, -3, 11], dtype=np.int64, name="foo")
tm.assert_index_equal(result, expected)


class TestWhere:
def test_where_putmask_range_cast(self):
Expand Down
0