From 1aec96090d3f8641d994e0e0393ad4ddd592cf9e Mon Sep 17 00:00:00 2001 From: Stuart Berg Date: Sun, 8 Sep 2019 17:43:12 -0400 Subject: [PATCH] _reconstruct_data(): Use copy=False when calling astype() --- pandas/core/algorithms.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/core/algorithms.py b/pandas/core/algorithms.py index 5a64a912dfaae..2e5ab0d182aff 100644 --- a/pandas/core/algorithms.py +++ b/pandas/core/algorithms.py @@ -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