Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pandas/core/arrays/sparse/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 8 additions & 8 deletions pandas/core/strings/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1547,48 +1547,48 @@ 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

Equivalent behaviour to:

>>> s.str[0:5:3]
0 kl
1 f
1 d
2 cm
dtype: object
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ filterwarnings =
junit_family=xunit2

[codespell]
ignore-words-list=ba,blocs,coo,datas,fo,hist,nd,ser
ignore-words-list=ba,blocs,coo,hist,nd,ser

[coverage:run]
branch = False
Expand Down