-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Bug in loc raised for numeric label even when label is in Index #37675
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 1 commit
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 |
---|---|---|
|
@@ -1579,3 +1579,13 @@ def test_loc_setitem_dt64tz_values(self): | |
s2["a"] = expected | ||
result = s2["a"] | ||
assert result == expected | ||
|
||
|
||
@pytest.mark.parametrize("klass", [DataFrame, Series]) | ||
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. IIRC this test should be in pandas/tests/frame/indexing/test_loc.py per our new org. 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. Was not quite sure where to place them, because of tests for DataFrame and Series. Would be happy to move them, if this place is better. 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. This is the correct file, should probably be inside TestLabelSlicing class. use 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. Done 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. There is no class |
||
@pytest.mark.parametrize("value", [1, 1.5]) | ||
def test_loc_int_in_object_index(klass, value): | ||
# GH: 26491 | ||
obj = klass(range(4), index=[value, "first", 2, "third"]) | ||
result = obj.loc[value:"third"] | ||
expected = klass(range(4), index=[value, "first", 2, "third"]) | ||
tm.assert_equal(result, expected) |
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.
looks like these can be the same case now
if (is_float(label) or is_integer(label)) and label not in self.values
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.
Done, thx