Skip to content

Commit

Permalink
_reconstruct_data(): Use copy=False when calling astype()
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarteberg committed Oct 6, 2019
1 parent 602c55d commit 1aec960
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ def _reconstruct_data(values, dtype, original):
if is_extension_array_dtype(dtype):
values = dtype.construct_array_type()._from_sequence(values)
elif is_bool_dtype(dtype):
values = values.astype(dtype)
values = values.astype(dtype, copy=False)

# we only support object dtypes bool Index
if isinstance(original, ABCIndexClass):
values = values.astype(object)
values = values.astype(object, copy=False)
elif dtype is not None:
values = values.astype(dtype)
values = values.astype(dtype, copy=False)

return values

Expand Down

0 comments on commit 1aec960

Please sign in to comment.