@@ -47,6 +47,18 @@ class SparseAccessor(BaseAccessor, PandasDelegate):
47
47
"""
48
48
Accessor for SparseSparse from other sparse matrix data types.
49
49
50
+ Parameters
51
+ ----------
52
+ data : Series or DataFrame
53
+ The Series or DataFrame to which the SparseAccessor is attached.
54
+
55
+ See Also
56
+ --------
57
+ Series.sparse.to_coo : Create a scipy.sparse.coo_matrix from a Series with
58
+ MultiIndex.
59
+ Series.sparse.from_coo : Create a Series with sparse values from a
60
+ scipy.sparse.coo_matrix.
61
+
50
62
Examples
51
63
--------
52
64
>>> ser = pd.Series([0, 0, 2, 2, 2], dtype="Sparse[int]")
@@ -135,7 +147,9 @@ def to_coo(
135
147
Parameters
136
148
----------
137
149
row_levels : tuple/list
150
+ MultiIndex levels to use for row coordinates, specified by name or index.
138
151
column_levels : tuple/list
152
+ MultiIndex levels to use for column coordinates, specified by name or index.
139
153
sort_labels : bool, default False
140
154
Sort the row and column labels before forming the sparse matrix.
141
155
When `row_levels` and/or `column_levels` refer to a single level,
@@ -144,8 +158,16 @@ def to_coo(
144
158
Returns
145
159
-------
146
160
y : scipy.sparse.coo_matrix
161
+ The sparse matrix in coordinate format.
147
162
rows : list (row labels)
163
+ Labels corresponding to the row coordinates.
148
164
columns : list (column labels)
165
+ Labels corresponding to the column coordinates.
166
+
167
+ See Also
168
+ --------
169
+ Series.sparse.from_coo : Create a Series with sparse values from a
170
+ scipy.sparse.coo_matrix.
149
171
150
172
Examples
151
173
--------
0 commit comments