Skip to content

Commit ef3368a

Browse files
authored
DOC: fix docstring validation errors for pandas.Series (#59633)
* fixed Series.sparse and Series.sparse.to_coo and removed from ci/code_checks.sh * fixed errors from pre-commit * fixed errors from pre-commit
1 parent eb05b13 commit ef3368a

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

ci/code_checks.sh

-2
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,10 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
134134
-i "pandas.Series.dt.tz_localize PR01,PR02" \
135135
-i "pandas.Series.dt.unit GL08" \
136136
-i "pandas.Series.pad PR01,SA01" \
137-
-i "pandas.Series.sparse PR01,SA01" \
138137
-i "pandas.Series.sparse.fill_value SA01" \
139138
-i "pandas.Series.sparse.from_coo PR07,SA01" \
140139
-i "pandas.Series.sparse.npoints SA01" \
141140
-i "pandas.Series.sparse.sp_values SA01" \
142-
-i "pandas.Series.sparse.to_coo PR07,RT03,SA01" \
143141
-i "pandas.Timedelta.asm8 SA01" \
144142
-i "pandas.Timedelta.ceil SA01" \
145143
-i "pandas.Timedelta.components SA01" \

pandas/core/arrays/sparse/accessor.py

+22
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ class SparseAccessor(BaseAccessor, PandasDelegate):
4747
"""
4848
Accessor for SparseSparse from other sparse matrix data types.
4949
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+
5062
Examples
5163
--------
5264
>>> ser = pd.Series([0, 0, 2, 2, 2], dtype="Sparse[int]")
@@ -135,7 +147,9 @@ def to_coo(
135147
Parameters
136148
----------
137149
row_levels : tuple/list
150+
MultiIndex levels to use for row coordinates, specified by name or index.
138151
column_levels : tuple/list
152+
MultiIndex levels to use for column coordinates, specified by name or index.
139153
sort_labels : bool, default False
140154
Sort the row and column labels before forming the sparse matrix.
141155
When `row_levels` and/or `column_levels` refer to a single level,
@@ -144,8 +158,16 @@ def to_coo(
144158
Returns
145159
-------
146160
y : scipy.sparse.coo_matrix
161+
The sparse matrix in coordinate format.
147162
rows : list (row labels)
163+
Labels corresponding to the row coordinates.
148164
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.
149171
150172
Examples
151173
--------

0 commit comments

Comments
 (0)