Skip to content

Commit

Permalink
DOC: improve warnings for Series.{real,imag} (#27651)
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari authored and jorisvandenbossche committed Jul 30, 2019
1 parent ffcbfc8 commit 143bc34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.25.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Numeric
Conversion
^^^^^^^^^^

-
- Improved the warnings for the deprecated methods :meth:`Series.real` and :meth:`Series.imag` (:issue:`27610`)
-
-

Expand Down
8 changes: 6 additions & 2 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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,
)
Expand Down

0 comments on commit 143bc34

Please sign in to comment.