Skip to content

Commit 1aec960

Browse files
committed
_reconstruct_data(): Use copy=False when calling astype()
1 parent 602c55d commit 1aec960

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/core/algorithms.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,13 @@ def _reconstruct_data(values, dtype, original):
180180
if is_extension_array_dtype(dtype):
181181
values = dtype.construct_array_type()._from_sequence(values)
182182
elif is_bool_dtype(dtype):
183-
values = values.astype(dtype)
183+
values = values.astype(dtype, copy=False)
184184

185185
# we only support object dtypes bool Index
186186
if isinstance(original, ABCIndexClass):
187-
values = values.astype(object)
187+
values = values.astype(object, copy=False)
188188
elif dtype is not None:
189-
values = values.astype(dtype)
189+
values = values.astype(dtype, copy=False)
190190

191191
return values
192192

0 commit comments

Comments
 (0)