Skip to content

make dtype to be ignored in constructors if data is Series or DataFrame #59383

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

Closed
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
1 change: 1 addition & 0 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ def __init__(
if isinstance(data, DataFrame):
data = data._mgr
allow_mgr = True
dtype = None
if not copy:
# if not copying data, ensure to still return a shallow copy
# to avoid the result sharing the same Manager
Expand Down
1 change: 1 addition & 0 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ def __init__(
"compound dtype. Use DataFrame instead."
)
elif isinstance(data, Series):
dtype = None
if index is None:
index = data.index
data = data._mgr.copy(deep=False)
Expand Down
Loading