Skip to content

Commit 82ca349

Browse files
committed
BUG: add warning when creating Series from Series with dtype keyword
When creating Series from another Series `dtype` keyword is not not used Make warning for users who expect it to have effect. See GH #59060.
1 parent 67a58cd commit 82ca349

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pandas/core/series.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,12 @@ def __init__(
451451
data = data.reindex(index)
452452
copy = False
453453
data = data._mgr
454+
if dtype is not None:
455+
warnings.warn(
456+
"dtype keyword is not used for Series created from Series",
457+
RuntimeWarning,
458+
stacklevel=2,
459+
)
454460
elif isinstance(data, Mapping):
455461
data, index = self._init_dict(data, index, dtype)
456462
dtype = None

0 commit comments

Comments
 (0)