-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DEPR: remove get_values, SparseArray.values #29989
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 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
47b89a1
DEPR: remove get_values, SparseArray.values
jbrockmendel cee0231
Merge branch 'master' of https://github.com/pandas-dev/pandas into de…
jbrockmendel 3b82f18
update docs
jbrockmendel 5573a9b
move docstrings to _internal_get_values
jbrockmendel 5346a76
Merge branch 'master' of https://github.com/pandas-dev/pandas into de…
jbrockmendel 65f3c67
update doc
jbrockmendel 596d28c
black fixup
jbrockmendel 12e19a4
Merge branch 'master' of https://github.com/pandas-dev/pandas into de…
jbrockmendel 5e05285
Merge branch 'master' of https://github.com/pandas-dev/pandas into de…
jbrockmendel bd346df
remove examples
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 |
---|---|---|
|
@@ -5470,13 +5470,10 @@ def _get_values(self): | |
# compat | ||
return self.values | ||
|
||
def get_values(self): | ||
def _internal_get_values(self): | ||
""" | ||
Return an ndarray after converting sparse values to dense. | ||
|
||
.. deprecated:: 0.25.0 | ||
Use ``np.asarray(..)`` or :meth:`DataFrame.values` instead. | ||
|
||
This is the same as ``.values`` for non-sparse data. For sparse | ||
data contained in a `SparseArray`, the data are first | ||
converted to a dense representation. | ||
|
@@ -5500,7 +5497,7 @@ def get_values(self): | |
0 1 True 1.0 | ||
1 2 False 2.0 | ||
|
||
>>> df.get_values() | ||
>>> df._internal_get_values() | ||
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 would just remove these examples as they are no longer relevant |
||
array([[1, True, 1.0], [2, False, 2.0]], dtype=object) | ||
|
||
>>> df = pd.DataFrame({"a": pd.SparseArray([1, None, None]), | ||
|
@@ -5511,20 +5508,11 @@ def get_values(self): | |
1 NaN 2.0 | ||
2 NaN 3.0 | ||
|
||
>>> df.get_values() | ||
>>> df._internal_get_values() | ||
array([[ 1., 1.], | ||
[nan, 2.], | ||
[nan, 3.]]) | ||
""" | ||
warnings.warn( | ||
"The 'get_values' method is deprecated and will be removed in a " | ||
"future version. Use '.values' or 'np.asarray(..)' instead.", | ||
FutureWarning, | ||
stacklevel=2, | ||
) | ||
return self._internal_get_values() | ||
|
||
def _internal_get_values(self): | ||
return self.values | ||
|
||
@property | ||
|
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
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.
Can you add part of the above docstring to this method? (the interesting parts for internal use, eg what it returns)
(and potentially the same comment for some of the other cases below)
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.
good idea