From 11d20f5fbe9e9b3a0919a884d932117c033691a8 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sat, 11 Sep 2021 00:20:02 +0200 Subject: [PATCH] Remove inplace argument for dask series renaming See issue #8082 --- dask/dataframe/core.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/dask/dataframe/core.py b/dask/dataframe/core.py index df6f64c5f025..63ef409b546c 100644 --- a/dask/dataframe/core.py +++ b/dask/dataframe/core.py @@ -3168,7 +3168,7 @@ def __repr__(self): task=len(self.dask), ) - def rename(self, index=None, inplace=False, sorted_index=False): + def rename(self, index=None, sorted_index=False): """Alter Series index labels or name Function / dict values must be unique (1-to-1). Labels not contained in @@ -3183,8 +3183,6 @@ def rename(self, index=None, inplace=False, sorted_index=False): If dict-like or callable, the transformation is applied to the index. Scalar or hashable sequence-like will alter the ``Series.name`` attribute. - inplace : boolean, default False - Whether to return a new Series or modify this one inplace. sorted_index : bool, default False If true, the output ``Series`` will have known divisions inferred from the input series and the transformation. Ignored for @@ -3212,7 +3210,7 @@ def rename(self, index=None, inplace=False, sorted_index=False): and not is_dict_like(index) and not isinstance(index, dd.Series) ): - res = self if inplace else self.copy() + res = self.copy() res.name = index else: res = self.map_partitions(M.rename, index, enforce_metadata=False) @@ -3229,12 +3227,6 @@ def rename(self, index=None, inplace=False, sorted_index=False): res.divisions = tuple(methods.tolist(new)) else: res = res.clear_divisions() - if inplace: - self.dask = res.dask - self._name = res._name - self.divisions = res.divisions - self._meta = res._meta - res = self return res @derived_from(pd.Series)