From 143bc34aa8f068b18e7137df7ca91b9929cc1389 Mon Sep 17 00:00:00 2001 From: h-vetinari <33685575+h-vetinari@users.noreply.github.com> Date: Tue, 30 Jul 2019 11:10:48 +0200 Subject: [PATCH] DOC: improve warnings for Series.{real,imag} (#27651) --- doc/source/whatsnew/v0.25.1.rst | 2 +- pandas/core/series.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/source/whatsnew/v0.25.1.rst b/doc/source/whatsnew/v0.25.1.rst index fa9ca98f9c8d8..fb67decb46b64 100644 --- a/doc/source/whatsnew/v0.25.1.rst +++ b/doc/source/whatsnew/v0.25.1.rst @@ -64,7 +64,7 @@ Numeric Conversion ^^^^^^^^^^ -- +- Improved the warnings for the deprecated methods :meth:`Series.real` and :meth:`Series.imag` (:issue:`27610`) - - diff --git a/pandas/core/series.py b/pandas/core/series.py index b445ff5f944de..106bb3c7d6cb4 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -955,7 +955,9 @@ def real(self): .. deprecated:: 0.25.0 """ warnings.warn( - "`real` has be deprecated and will be removed in a future version", + "`real` is deprecated and will be removed in a future version. " + "To eliminate this warning for a Series `ser`, use " + "`np.real(ser.to_numpy())` or `ser.to_numpy().real`.", FutureWarning, stacklevel=2, ) @@ -973,7 +975,9 @@ def imag(self): .. deprecated:: 0.25.0 """ warnings.warn( - "`imag` has be deprecated and will be removed in a future version", + "`imag` is deprecated and will be removed in a future version. " + "To eliminate this warning for a Series `ser`, use " + "`np.imag(ser.to_numpy())` or `ser.to_numpy().imag`.", FutureWarning, stacklevel=2, )