Skip to content

improve warnings for Series.{real,imag} #27651

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 3 commits into from
Jul 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
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