Skip to content

DEPR: deprecate get_values #26409

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
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 whatsnew note
  • Loading branch information
jorisvandenbossche committed Jul 1, 2019
commit 990c72cbf6dadad8b276bf5abbee9591b1a168c6
3 changes: 3 additions & 0 deletions doc/source/whatsnew/v0.25.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,9 @@ Other deprecations
Use the public attributes :attr:`~RangeIndex.start`, :attr:`~RangeIndex.stop` and :attr:`~RangeIndex.step` instead (:issue:`26581`).
- The :meth:`Series.ftype`, :meth:`Series.ftypes` and :meth:`DataFrame.ftypes` methods are deprecated and will be removed in a future version.
Instead, use :meth:`Series.dtype` and :meth:`DataFrame.dtypes` (:issue:`26705`).
- The :meth:`Series.get_values`, :meth:`DataFrame.get_values`, :meth:`Index.get_values`,
:meth:`SparseArray.get_values` and :meth:`Categorical.get_values` methods are deprecated.
One of ``np.asarray(..)`` or :meth:`~Series.to_numpy` can be used instead (:issue:`19617`).
- :meth:`Timedelta.resolution` is deprecated and replaced with :meth:`Timedelta.resolution_string`. In a future version, :meth:`Timedelta.resolution` will be changed to behave like the standard library :attr:`timedelta.resolution` (:issue:`21344`)

.. _whatsnew_0250.prior_deprecations:
Expand Down
4 changes: 3 additions & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5329,6 +5329,7 @@ def 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
Expand Down Expand Up @@ -5371,7 +5372,8 @@ def get_values(self):
"""
warnings.warn(
"The 'get_values' method is deprecated and will be removed in a "
"future version", FutureWarning, stacklevel=2)
"future version. Use '.values' or 'np.asarray(..)' instead.",
FutureWarning, stacklevel=2)
return self._internal_get_values()

def _internal_get_values(self):
Expand Down
4 changes: 3 additions & 1 deletion pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3773,6 +3773,7 @@ def get_values(self):
Return `Index` data as an `numpy.ndarray`.

.. deprecated:: 0.25.0
Use :meth:`Index.to_numpy` or :attr:`Index.array` instead.

Returns
-------
Expand Down Expand Up @@ -3814,7 +3815,8 @@ def get_values(self):
"""
warnings.warn(
"The 'get_values' method is deprecated and will be removed in a "
"future version", FutureWarning, stacklevel=2)
"future version. Use '.to_numpy()' or '.array' instead.",
FutureWarning, stacklevel=2)
return self._internal_get_values()

def _internal_get_values(self):
Expand Down
4 changes: 3 additions & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ def get_values(self):
Same as values (but handles sparseness conversions); is a view.

.. deprecated:: 0.25.0
Use :meth:`Series.to_numpy` or :attr:`Series.array` instead.

Returns
-------
Expand All @@ -515,7 +516,8 @@ def get_values(self):
"""
warnings.warn(
"The 'get_values' method is deprecated and will be removed in a "
"future version", FutureWarning, stacklevel=2)
"future version. Use '.to_numpy()' or '.array' instead.",
FutureWarning, stacklevel=2)
return self._internal_get_values()

def _internal_get_values(self):
Expand Down