-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Fix is_unique
regression for slices of Index
es
#57958
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
Changes from 6 commits
e14f3e5
78bca47
360aa3b
4ab184b
3fb2b4f
4916d5c
512ba5c
06e21ab
8aff236
1d68e8e
3f5bdca
8a2fd84
dc2ce58
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -961,6 +961,26 @@ def test_slice_keep_name(self): | |
index = Index(["a", "b"], name="asdf") | ||
assert index.name == index[1:].name | ||
|
||
def test_slice_is_unique(self): | ||
# GH 57911 | ||
index = Index([1, 1, 2, 3, 4]) | ||
assert not index.is_unique | ||
filtered_index = index[2:].copy() | ||
assert filtered_index.is_unique | ||
|
||
def test_slice_is_montonic(self): | ||
"""Test that is_monotonic resets on slices.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not exactly "resets on slices" after your last commit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is a docstring and a comment referencing the GitHub issue too much? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the function name explains it all, but it's up to you |
||
index = Index([1, 2, 3, 3]) | ||
assert not index.is_monotonic_decreasing | ||
|
||
filtered_index = index[2:].copy() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you also test a null slice i.e. |
||
assert filtered_index.is_monotonic_decreasing | ||
assert filtered_index.is_monotonic_increasing | ||
|
||
filtered_index = index[1:].copy() | ||
assert not filtered_index.is_monotonic_decreasing | ||
assert filtered_index.is_monotonic_increasing | ||
|
||
@pytest.mark.parametrize( | ||
"index", | ||
[ | ||
|
Uh oh!
There was an error while loading. Please reload this page.