-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DEPR: enforce indexing deprecations #49511
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
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5cebd1f
DEPR: enforce deprecation of string indexing on DataFrame rows
jbrockmendel 8096263
DEPR: set, dict indexers, DataFrame indexer in iloc
jbrockmendel 1cf03bb
DEPR: disallow passing list to xs
jbrockmendel e4aca48
Merge branch 'main' into depr-indexing-3
jbrockmendel eff1cb6
update doc
jbrockmendel 585dd2e
Merge branch 'main' into depr-indexing-3
jbrockmendel 472b49a
update docstring, typo fixup
jbrockmendel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1711,14 +1711,14 @@ def test_loc_on_multiindex_one_level(self): | |||||
tm.assert_frame_equal(result, expected) | ||||||
|
||||||
|
||||||
class TestDepreactedIndexers: | ||||||
class TestDeprecatedIndexers: | ||||||
@pytest.mark.parametrize( | ||||||
"key", [{1}, {1: 1}, ({1}, "a"), ({1: 1}, "a"), (1, {"a"}), (1, {"a": "a"})] | ||||||
) | ||||||
def test_getitem_dict_and_set_deprecated(self, key): | ||||||
# GH#42825 | ||||||
# GH#42825 enforced in 2.0 enforced in 2.0 | ||||||
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.
Suggested change
|
||||||
df = DataFrame([[1, 2], [3, 4]], columns=["a", "b"]) | ||||||
with tm.assert_produces_warning(FutureWarning): | ||||||
with pytest.raises(TypeError, match="as an indexer is not supported"): | ||||||
df.loc[key] | ||||||
|
||||||
@pytest.mark.parametrize( | ||||||
|
@@ -1733,22 +1733,22 @@ def test_getitem_dict_and_set_deprecated(self, key): | |||||
], | ||||||
) | ||||||
def test_getitem_dict_and_set_deprecated_multiindex(self, key): | ||||||
# GH#42825 | ||||||
# GH#42825 enforced in 2.0 | ||||||
df = DataFrame( | ||||||
[[1, 2], [3, 4]], | ||||||
columns=["a", "b"], | ||||||
index=MultiIndex.from_tuples([(1, 2), (3, 4)]), | ||||||
) | ||||||
with tm.assert_produces_warning(FutureWarning): | ||||||
with pytest.raises(TypeError, match="as an indexer is not supported"): | ||||||
df.loc[key] | ||||||
|
||||||
@pytest.mark.parametrize( | ||||||
"key", [{1}, {1: 1}, ({1}, "a"), ({1: 1}, "a"), (1, {"a"}), (1, {"a": "a"})] | ||||||
) | ||||||
def test_setitem_dict_and_set_deprecated(self, key): | ||||||
# GH#42825 | ||||||
def test_setitem_dict_and_set_disallowed(self, key): | ||||||
# GH#42825 enforced in 2.0 | ||||||
df = DataFrame([[1, 2], [3, 4]], columns=["a", "b"]) | ||||||
with tm.assert_produces_warning(FutureWarning): | ||||||
with pytest.raises(TypeError, match="as an indexer is not supported"): | ||||||
df.loc[key] = 1 | ||||||
|
||||||
@pytest.mark.parametrize( | ||||||
|
@@ -1762,12 +1762,12 @@ def test_setitem_dict_and_set_deprecated(self, key): | |||||
((1, 2), {"a": "a"}), | ||||||
], | ||||||
) | ||||||
def test_setitem_dict_and_set_deprecated_multiindex(self, key): | ||||||
# GH#42825 | ||||||
def test_setitem_dict_and_set_disallowed_multiindex(self, key): | ||||||
# GH#42825 enforced in 2.0 | ||||||
df = DataFrame( | ||||||
[[1, 2], [3, 4]], | ||||||
columns=["a", "b"], | ||||||
index=MultiIndex.from_tuples([(1, 2), (3, 4)]), | ||||||
) | ||||||
with tm.assert_produces_warning(FutureWarning): | ||||||
with pytest.raises(TypeError, match="as an indexer is not supported"): | ||||||
df.loc[key] = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could you update this docstring?
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.
updated + green