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, )