8000 BUG: ArrayManager not respecting copy keyword by jbrockmendel · Pull Request #44889 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

BUG: ArrayManager not respecting copy keyword #44889

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 7 commits into from
Jan 14, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
avoid double-copy
  • Loading branch information
jbrockmendel committed Dec 28, 2021
commit 01c6ad2caf414ab0611771fea3708417dd747eb8
8 changes: 6 additions & 2 deletions pandas/core/internals/construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,12 @@ def dict_to_mgr(
arrays = [arr if not isinstance(arr, Index) else arr._data for arr in arrays]

if copy:
# dtype attr check to exclude EADtype-castable strs
arrays = [x if not hasattr(x, "dtype") else x.copy() for x in arrays]
if typ == "block":
# We only need to copy arrays that will not get consolidated, i.e.
# only EA arrays
arrays = [x.copy() if isinstance(x, ExtensionArray) else x for x in arrays]
else:
arrays = [x.copy() for x in arrays]

return arrays_to_mgr(arrays, columns, index, dtype=dtype, typ=typ, consolidate=copy)

Expand Down
0