@@ -47,6 +47,16 @@ 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 MultiIndex.
58
+ Series.sparse.from_coo : Create a Series with sparse values from a scipy.sparse.coo_matrix.
59
+
50
60
Examples
51
61
--------
52
62
>>> ser = pd.Series([0, 0, 2, 2, 2], dtype="Sparse[int]")
@@ -135,7 +145,9 @@ def to_coo(
135
145
Parameters
136
146
----------
137
147
row_levels : tuple/list
148
+ MultiIndex levels to use for row coordinates, specified by name or index.
138
149
column_levels : tuple/list
150
+ MultiIndex levels to use for column coordinates, specified by name or index.
139
151
sort_labels : bool, default False
140
152
Sort the row and column labels before forming the sparse matrix.
141
153
When `row_levels` and/or `column_levels` refer to a single level,
@@ -144,8 +156,15 @@ def to_coo(
144
156
Returns
145
157
-------
146
158
y : scipy.sparse.coo_matrix
159
+ The sparse matrix in coordinate format.
147
160
rows : list (row labels)
161
+ Labels corresponding to the row coordinates.
148
162
columns : list (column labels)
163
+ Labels corresponding to the column coordinates.
164
+
165
+ See Also
166
+ --------
167
+ Series.sparse.from_coo : Create a Series with sparse values from a scipy.sparse.coo_matrix.
149
168
150
169
Examples
151
170
--------
0 commit comments