Skip to content

Commit 6f97b57

Browse files
Backport PR pandas-dev#59094 on branch 2.2.x (BUG: Fix sparse doctests for SciPy 1.14.0) (pandas-dev#59104)
Backport PR pandas-dev#59094: BUG: Fix sparse doctests for SciPy 1.14.0 Co-authored-by: Lysandros Nikolaou <[email protected]>
1 parent 2a1417a commit 6f97b57

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pandas/core/arrays/sparse/accessor.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ def from_coo(cls, A, dense_index: bool = False) -> Series:
9292
... ([3.0, 1.0, 2.0], ([1, 0, 0], [0, 2, 3])), shape=(3, 4)
9393
... )
9494
>>> A
95-
<3x4 sparse matrix of type '<class 'numpy.float64'>'
96-
with 3 stored elements in COOrdinate format>
95+
<COOrdinate sparse matrix of dtype 'float64'
96+
with 3 stored elements and shape (3, 4)>
9797
9898
>>> A.todense()
9999
matrix([[0., 0., 1., 2.],
@@ -178,8 +178,8 @@ def to_coo(self, row_levels=(0,), column_levels=(1,), sort_labels: bool = False)
178178
... row_levels=["A", "B"], column_levels=["C", "D"], sort_labels=True
179179
... )
180180
>>> A
181-
<3x4 sparse matrix of type '<class 'numpy.float64'>'
182-
with 3 stored elements in COOrdinate format>
181+
<COOrdinate sparse matrix of dtype 'float64'
182+
with 3 stored elements and shape (3, 4)>
183183
>>> A.todense()
184184
matrix([[0., 0., 1., 3.],
185185
[3., 0., 0., 0.],
@@ -350,8 +350,8 @@ def to_coo(self):
350350
--------
351351
>>> df = pd.DataFrame({"A": pd.arrays.SparseArray([0, 1, 0, 1])})
352352
>>> df.sparse.to_coo()
353-
<4x1 sparse matrix of type '<class 'numpy.int64'>'
354-
with 2 stored elements in COOrdinate format>
353+
<COOrdinate sparse matrix of dtype 'int64'
354+
with 2 stored elements and shape (4, 1)>
355355
"""
356356
import_optional_dependency("scipy")
357357
from scipy.sparse import coo_matrix

0 commit comments

Comments
 (0)