-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Deprecate series.nonzero (GH18262) #24048
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 all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7f422d4
Deprecate series.nonzero (GH18262)
makbigc 54ea943
Add test
makbigc 481482f
Update warning msg
makbigc 73f5132
Get rid of nonzero() in dropna()
makbigc 1126d3a
Get rid of series.nonzero() in drop_duplicate()
makbigc d9db2c4
Update warning msg
makbigc d954d1d
Change the arg of np.argwhere
makbigc cf64d04
Remove Series.nonzero from api.rst
makbigc 7ee2984
Update _do_convert_missing and dropna in frame.py
makbigc 09823e0
Get rid of series.nonzero in test_reindex_level
makbigc cad0473
Change pytest.warns to tm.assert_produces_warning
makbigc 850de6d
Change _values to _ndarray_values in drop_duplicates
makbigc 8278828
Change values to to_numpy() in test_verify_first_level
makbigc eacead8
Update deprecation warning in nonzero
makbigc 88c9e16
Change values to _ndarray_values in _do_convert_missing
makbigc 4674696
Remove nonzero method from api/series.rst
makbigc 959f0e2
Update deprecation msg in nonzero
makbigc 7747040
Merge branch 'master' into PR_TOOL_MERGE_PR_24048
jreback e3b6b1b
rm api.rst
jreback 541e816
doc-string
jreback 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -540,6 +540,9 @@ def nonzero(self): | |
""" | ||
Return the *integer* indices of the elements that are non-zero. | ||
|
||
.. deprecated:: 0.24.0 | ||
Please use .to_numpy().nonzero() as a replacement. | ||
|
||
This method is equivalent to calling `numpy.nonzero` on the | ||
series data. For compatibility with NumPy, the return value is | ||
the same (a tuple with an array of indices for each dimension), | ||
|
@@ -569,6 +572,10 @@ def nonzero(self): | |
d 4 | ||
dtype: int64 | ||
""" | ||
msg = ("Series.nonzero() is deprecated " | ||
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. can you show what it is replaced by here |
||
"and will be removed in a future version." | ||
"Use Series.to_numpy().nonzero() instead") | ||
warnings.warn(msg, FutureWarning, stacklevel=2) | ||
return self._values.nonzero() | ||
|
||
def put(self, *args, **kwargs): | ||
|
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
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.
Uh oh!
There was an error while loading. Please reload this page.