Skip to content

Commit ac6dca2

Browse files
jorisvandenbosscheTomAugspurger
authored andcommitted
DOC: improve warnings for Series.{real,imag} (#27651) (#27659)
1 parent 1125126 commit ac6dca2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

doc/source/whatsnew/v0.25.1.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Numeric
6464
Conversion
6565
^^^^^^^^^^
6666

67-
-
67+
- Improved the warnings for the deprecated methods :meth:`Series.real` and :meth:`Series.imag` (:issue:`27610`)
6868
-
6969
-
7070

pandas/core/series.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,9 @@ def real(self):
958958
.. deprecated 0.25.0
959959
"""
960960
warnings.warn(
961-
"`real` has be deprecated and will be removed in a " "future verison",
961+
"`real` is deprecated and will be removed in a future version. "
962+
"To eliminate this warning for a Series `ser`, use "
963+
"`np.real(ser.to_numpy())` or `ser.to_numpy().real`.",
962964
FutureWarning,
963965
stacklevel=2,
964966
)
@@ -976,7 +978,9 @@ def imag(self):
976978
.. deprecated 0.25.0
977979
"""
978980
warnings.warn(
979-
"`imag` has be deprecated and will be removed in a " "future verison",
981+
"`imag` is deprecated and will be removed in a future version. "
982+
"To eliminate this warning for a Series `ser`, use "
983+
"`np.imag(ser.to_numpy())` or `ser.to_numpy().imag`.",
980984
FutureWarning,
981985
stacklevel=2,
982986
)

0 commit comments

Comments
 (0)