Skip to content
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

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

Merged
merged 3 commits into from
Jul 30, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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` has be deprecated and will be removed in a future "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"`real` has be deprecated and will be removed in a future "
"`real` is deprecated and will be removed in a future "

fixing an existing typo at once

"version. To eliminate this warning for a Series `ser`, use "
"`np.real(ser.to_array())` or `ser.to_array().real`.",
h-vetinari marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the to_array be a to_numpy ?

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` has be deprecated and will be removed in a future "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"`imag` has be deprecated and will be removed in a future "
"`imag` is deprecated and will be removed in a future "

"version. To eliminate this warning for a Series `ser`, use "
"`np.imag(ser.to_array())` or `ser.to_array().imag`.",
FutureWarning,
stacklevel=2,
)
Expand Down