From a49f54b2d94e75d43a0dc8d110389b1b21546b77 Mon Sep 17 00:00:00 2001 From: chinggg <24590067+chinggg@users.noreply.github.com> Date: Thu, 31 Dec 2020 17:16:58 +0800 Subject: [PATCH 1/3] CI,STYLE: narrow down ignore-words-list of codespell --- .codespellignorelines | 7 +++++++ pandas/core/arrays/sparse/accessor.py | 8 ++++---- setup.cfg | 3 ++- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 .codespellignorelines diff --git a/.codespellignorelines b/.codespellignorelines new file mode 100644 index 0000000000000..0993ce3c93473 --- /dev/null +++ b/.codespellignorelines @@ -0,0 +1,7 @@ + 1 fo + end_types = {"M", "A", "Q", "BM", "BA", "BQ", "W"} + >>> df.replace(to_replace=r'^ba.$', value='new', regex=True) + >>> df.replace({{'A': r'^ba.$'}}, {{'A': 'new'}}, regex=True) + >>> df.replace(regex=r'^ba.$', value='new') + >>> df.replace(regex={{r'^ba.$': 'new', 'foo': 'xyz'}}) + >>> df.replace(regex=[r'^ba.$', 'foo'], value='new') diff --git a/pandas/core/arrays/sparse/accessor.py b/pandas/core/arrays/sparse/accessor.py index 12f29faab9574..c0bc88dc54e43 100644 --- a/pandas/core/arrays/sparse/accessor.py +++ b/pandas/core/arrays/sparse/accessor.py @@ -333,18 +333,18 @@ def to_coo(self): if isinstance(dtype, SparseDtype): dtype = dtype.subtype - cols, rows, datas = [], [], [] + cols, rows, data = [], [], [] for col, name in enumerate(self._parent): s = self._parent[name] row = s.array.sp_index.to_int_index().indices cols.append(np.repeat(col, len(row))) rows.append(row) - datas.append(s.array.sp_values.astype(dtype, copy=False)) + data.append(s.array.sp_values.astype(dtype, copy=False)) cols = np.concatenate(cols) rows = np.concatenate(rows) - datas = np.concatenate(datas) - return coo_matrix((datas, (rows, cols)), shape=self._parent.shape) + data = np.concatenate(data) + return coo_matrix((data, (rows, cols)), shape=self._parent.shape) @property def density(self) -> float: diff --git a/setup.cfg b/setup.cfg index 56b2fa190ac99..baf37b8fc0e78 100644 --- a/setup.cfg +++ b/setup.cfg @@ -64,7 +64,8 @@ filterwarnings = junit_family=xunit2 [codespell] -ignore-words-list=ba,blocs,coo,datas,fo,hist,nd,ser +ignore-words-list=blocs,coo,hist,nd,ser +exclude-file=.codespellignorelines [coverage:run] branch = False From 40f1f67d9fc4fc941b0f80578fd4d58147b03666 Mon Sep 17 00:00:00 2001 From: chinggg <24590067+chinggg@users.noreply.github.com> Date: Sun, 3 Jan 2021 23:47:41 +0800 Subject: [PATCH 2/3] CI,STYLE: remove codespellignorelines --- .codespellignorelines | 7 ------- setup.cfg | 3 +-- 2 files changed, 1 insertion(+), 9 deletions(-) delete mode 100644 .codespellignorelines diff --git a/.codespellignorelines b/.codespellignorelines deleted file mode 100644 index 0993ce3c93473..0000000000000 --- a/.codespellignorelines +++ /dev/null @@ -1,7 +0,0 @@ - 1 fo - end_types = {"M", "A", "Q", "BM", "BA", "BQ", "W"} - >>> df.replace(to_replace=r'^ba.$', value='new', regex=True) - >>> df.replace({{'A': r'^ba.$'}}, {{'A': 'new'}}, regex=True) - >>> df.replace(regex=r'^ba.$', value='new') - >>> df.replace(regex={{r'^ba.$': 'new', 'foo': 'xyz'}}) - >>> df.replace(regex=[r'^ba.$', 'foo'], value='new') diff --git a/setup.cfg b/setup.cfg index baf37b8fc0e78..a4ea65bbfe32f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -64,8 +64,7 @@ filterwarnings = junit_family=xunit2 [codespell] -ignore-words-list=blocs,coo,hist,nd,ser -exclude-file=.codespellignorelines +ignore-words-list=ba,blocs,coo,fo,hist,nd,ser [coverage:run] branch = False From 261093d458f50356d403b39bf34ae2e534ff2b8a Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Sun, 3 Jan 2021 18:12:57 +0000 Subject: [PATCH 3/3] use 'dog' in example rather than 'fox' --- pandas/core/strings/accessor.py | 16 ++++++++-------- setup.cfg | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pandas/core/strings/accessor.py b/pandas/core/strings/accessor.py index 339ad2653fcfb..eb14f75ab56f7 100644 --- a/pandas/core/strings/accessor.py +++ b/pandas/core/strings/accessor.py @@ -1547,40 +1547,40 @@ def slice(self, start=None, stop=None, step=None): Examples -------- - >>> s = pd.Series(["koala", "fox", "chameleon"]) + >>> s = pd.Series(["koala", "dog", "chameleon"]) >>> s 0 koala - 1 fox + 1 dog 2 chameleon dtype: object >>> s.str.slice(start=1) 0 oala - 1 ox + 1 og 2 hameleon dtype: object >>> s.str.slice(start=-1) 0 a - 1 x + 1 g 2 n dtype: object >>> s.str.slice(stop=2) 0 ko - 1 fo + 1 do 2 ch dtype: object >>> s.str.slice(step=2) 0 kaa - 1 fx + 1 dg 2 caeen dtype: object >>> s.str.slice(start=0, stop=5, step=3) 0 kl - 1 f + 1 d 2 cm dtype: object @@ -1588,7 +1588,7 @@ def slice(self, start=None, stop=None, step=None): >>> s.str[0:5:3] 0 kl - 1 f + 1 d 2 cm dtype: object """ diff --git a/setup.cfg b/setup.cfg index a4ea65bbfe32f..226f5353d8afc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -64,7 +64,7 @@ filterwarnings = junit_family=xunit2 [codespell] -ignore-words-list=ba,blocs,coo,fo,hist,nd,ser +ignore-words-list=ba,blocs,coo,hist,nd,ser [coverage:run] branch = False