Skip to content

Commit febfc0b

Browse files
DOC: fix PR07,SA01,ES01 for pandas.Series.sparse.from_coo (#59980)
1 parent c8813ae commit febfc0b

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

ci/code_checks.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
9696
-i "pandas.Series.dt.tz_localize PR01,PR02" \
9797
-i "pandas.Series.dt.unit GL08" \
9898
-i "pandas.Series.pad PR01,SA01" \
99-
-i "pandas.Series.sparse.from_coo PR07,SA01" \
10099
-i "pandas.Timedelta.max PR02" \
101100
-i "pandas.Timedelta.min PR02" \
102101
-i "pandas.Timedelta.resolution PR02" \

pandas/core/arrays/sparse/accessor.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,17 @@ def from_coo(cls, A, dense_index: bool = False) -> Series:
8888
"""
8989
Create a Series with sparse values from a scipy.sparse.coo_matrix.
9090
91+
This method takes a ``scipy.sparse.coo_matrix`` (coordinate format) as input and
92+
returns a pandas ``Series`` where the non-zero elements are represented as
93+
sparse values. The index of the Series can either include only the coordinates
94+
of non-zero elements (default behavior) or the full sorted set of coordinates
95+
from the matrix if ``dense_index`` is set to `True`.
96+
9197
Parameters
9298
----------
9399
A : scipy.sparse.coo_matrix
100+
The sparse matrix in coordinate format from which the sparse Series
101+
will be created.
94102
dense_index : bool, default False
95103
If False (default), the index consists of only the
96104
coords of the non-null entries of the original coo_matrix.
@@ -102,6 +110,12 @@ def from_coo(cls, A, dense_index: bool = False) -> Series:
102110
s : Series
103111
A Series with sparse values.
104112
113+
See Also
114+
--------
115+
DataFrame.sparse.from_spmatrix : Create a new DataFrame from a scipy sparse
116+
matrix.
117+
scipy.sparse.coo_matrix : A sparse matrix in COOrdinate format.
118+
105119
Examples
106120
--------
107121
>>> from scipy import sparse

0 commit comments

Comments
 (0)