Skip to content

Commit cb3b4e4

Browse files
authored
BUG: ArrayManager construction unwanted copy (#42689)
1 parent a3eee5b commit cb3b4e4

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

pandas/core/internals/construction.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,14 @@ def ndarray_to_mgr(
331331
if dtype is None and is_object_dtype(values.dtype):
332332
arrays = [
333333
ensure_wrapped_if_datetimelike(
334-
maybe_infer_to_datetimelike(values[:, i].copy())
334+
maybe_infer_to_datetimelike(values[:, i])
335335
)
336336
for i in range(values.shape[1])
337337
]
338338
else:
339339
if is_datetime_or_timedelta_dtype(values.dtype):
340340
values = ensure_wrapped_if_datetimelike(values)
341-
arrays = [values[:, i].copy() for i in range(values.shape[1])]
341+
arrays = [values[:, i] for i in range(values.shape[1])]
342342

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

pandas/tests/frame/methods/test_values.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,7 @@ def test_values_lcd(self, mixed_float_frame, mixed_int_frame):
226226

227227

228228
class TestPrivateValues:
229-
def test_private_values_dt64tz(self, using_array_manager, request):
230-
if using_array_manager:
231-
mark = pytest.mark.xfail(reason="doesn't share memory")
232-
request.node.add_marker(mark)
229+
def test_private_values_dt64tz(self, request):
233230

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

0 commit comments

Comments
 (0)