Skip to content
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

DEPR: deprecate get_values #26409

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add deprecation notes
  • Loading branch information
jorisvandenbossche committed Jun 28, 2019
commit ec370afbc40dd8a9d24f05fbb64b57c7c6ed38c6
2 changes: 2 additions & 0 deletions pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,8 @@ def get_values(self):
"""
Return the values.

.. deprecated:: 0.25.0

For internal compatibility with pandas formatting.

Returns
Expand Down
9 changes: 8 additions & 1 deletion pandas/core/arrays/sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1472,9 +1472,16 @@ def to_dense(self):
# get_values = to_dense

def get_values(self):
"""
Convert SparseArray to a NumPy array.

.. deprecated:: 0.25.0
Use `to_dense` instead.

"""
warnings.warn(
"The 'get_values' method is deprecated and will be removed in a "
"future version", stacklevel=2)
"future version. Use the 'to_dense' method instead.", stacklevel=2)
return self._interal_get_values()

_internal_get_values = to_dense
Expand Down
2 changes: 2 additions & 0 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5328,6 +5328,8 @@ def get_values(self):
"""
Return an ndarray after converting sparse values to dense.

.. deprecated:: 0.25.0

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.
Expand Down
2 changes: 2 additions & 0 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3772,6 +3772,8 @@ def get_values(self):
"""
Return `Index` data as an `numpy.ndarray`.

.. deprecated:: 0.25.0

Returns
-------
numpy.ndarray
Expand Down
7 changes: 6 additions & 1 deletion pandas/core/indexes/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,12 @@ def _wrap_setop_result(self, other, result):
return self._shallow_copy(result, name=name)

def get_values(self):
""" return the underlying data as an ndarray """
"""
jorisvandenbossche marked this conversation as resolved.
Show resolved Hide resolved
Return the underlying data as an ndarray

.. deprecated:: 0.25.0

"""
warnings.warn(
"The 'get_values' method is deprecated and will be removed in a "
"future version", stacklevel=2)
Expand Down
6 changes: 4 additions & 2 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,10 @@ def get_values(self):
numpy.ndarray
Data of the Series.
"""
raise Exception("USING GET_VALUES")
#warnings.warn("deprecated", FutureWarning, stacklevel=2)
warnings.warn(
"The 'get_values' method is deprecated and will be removed in a "
"future version", stacklevel=2)
return self._interal_get_values()

def _internal_get_values(self):
return self._data.get_values()
Expand Down