From a031e8a26ce64981bc15ea4c91b96bfeb5b205ee Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Tue, 10 Aug 2021 09:43:32 -0700 Subject: [PATCH] Inline copy logic. --- python/cudf/cudf/core/series.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/python/cudf/cudf/core/series.py b/python/cudf/cudf/core/series.py index 5618ea3176d..f10dca3e610 100644 --- a/python/cudf/cudf/core/series.py +++ b/python/cudf/cudf/core/series.py @@ -3008,11 +3008,10 @@ def astype(self, dtype, copy=False, errors="raise"): return self.copy(deep=copy) try: data = self._column.astype(dtype) - if copy: - data = data.copy(deep=True) return self._from_data( - {self.name: data.copy(deep=True)}, index=self._index + {self.name: (data.copy(deep=True) if copy else data)}, + index=self._index, ) except Exception as e: