Skip to content

BUG: ArrayManager construction unwanted copy #42689

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 1 commit into from
Jul 23, 2021
Merged
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
4 changes: 2 additions & 2 deletions pandas/core/internals/construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,14 @@ def ndarray_to_mgr(
if dtype is None and is_object_dtype(values.dtype):
arrays = [
ensure_wrapped_if_datetimelike(
maybe_infer_to_datetimelike(values[:, i].copy())
maybe_infer_to_datetimelike(values[:, i])
)
for i in range(values.shape[1])
]
else:
if is_datetime_or_timedelta_dtype(values.dtype):
values = ensure_wrapped_if_datetimelike(values)
arrays = [values[:, i].copy() for i in range(values.shape[1])]
arrays = [values[:, i] for i in range(values.shape[1])]

return ArrayManager(arrays, [index, columns], verify_integrity=False)

Expand Down
5 changes: 1 addition & 4 deletions pandas/tests/frame/methods/test_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,7 @@ def test_values_lcd(self, mixed_float_frame, mixed_int_frame):


class TestPrivateValues:
def test_private_values_dt64tz(self, using_array_manager, request):
if using_array_manager:
mark = pytest.mark.xfail(reason="doesn't share memory")
request.node.add_marker(mark)
def test_private_values_dt64tz(self, request):

dta = date_range("2000", periods=4, tz="US/Central")._data.reshape(-1, 1)

Expand Down