-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
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]) | ||
|
||
| @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.valuesThere 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