diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 66f6bfd7195f9..d9d603f73f2dd 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -108,11 +108,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.DataFrame.reorder_levels SA01" \ -i "pandas.DataFrame.sem PR01,RT03,SA01" \ -i "pandas.DataFrame.skew RT03,SA01" \ - -i "pandas.DataFrame.sparse PR01,SA01" \ - -i "pandas.DataFrame.sparse.density SA01" \ - -i "pandas.DataFrame.sparse.from_spmatrix SA01" \ - -i "pandas.DataFrame.sparse.to_coo SA01" \ - -i "pandas.DataFrame.sparse.to_dense SA01" \ + -i "pandas.DataFrame.sparse PR01" \ -i "pandas.DataFrame.std PR01,RT03,SA01" \ -i "pandas.DataFrame.sum RT03" \ -i "pandas.DataFrame.swaplevel SA01" \ diff --git a/pandas/core/arrays/sparse/accessor.py b/pandas/core/arrays/sparse/accessor.py index 58199701647d1..1f82285e3e40e 100644 --- a/pandas/core/arrays/sparse/accessor.py +++ b/pandas/core/arrays/sparse/accessor.py @@ -243,6 +243,10 @@ class SparseFrameAccessor(BaseAccessor, PandasDelegate): """ DataFrame accessor for sparse data. + See Also + -------- + DataFrame.sparse.density : Ratio of non-sparse points to total (dense) data points. + Examples -------- >>> df = pd.DataFrame({"a": [1, 2, 0, 0], "b": [3, 0, 0, 4]}, dtype="Sparse[int]") @@ -274,6 +278,11 @@ def from_spmatrix(cls, data, index=None, columns=None) -> DataFrame: Each column of the DataFrame is stored as a :class:`arrays.SparseArray`. + See Also + -------- + DataFrame.sparse.to_coo : Return the contents of the frame as a + sparse SciPy COO matrix. + Examples -------- >>> import scipy.sparse @@ -319,6 +328,11 @@ def to_dense(self) -> DataFrame: DataFrame A DataFrame with the same values stored as dense arrays. + See Also + -------- + DataFrame.sparse.density : Ratio of non-sparse points to total + (dense) data points. + Examples -------- >>> df = pd.DataFrame({"A": pd.arrays.SparseArray([0, 1, 0])}) @@ -343,6 +357,10 @@ def to_coo(self) -> spmatrix: If the caller is heterogeneous and contains booleans or objects, the result will be of dtype=object. See Notes. + See Also + -------- + DataFrame.sparse.to_dense : Convert a DataFrame with sparse values to dense. + Notes ----- The dtype will be the lowest-common-denominator type (implicit @@ -388,6 +406,11 @@ def density(self) -> float: """ Ratio of non-sparse points to total (dense) data points. + See Also + -------- + DataFrame.sparse.from_spmatrix : Create a new DataFrame from a + scipy sparse matrix. + Examples -------- >>> df = pd.DataFrame({"A": pd.arrays.SparseArray([0, 1, 0, 1])})