From 4eabe8400f3e6d2a52047d14346c8fa9cddee746 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Wed, 29 May 2019 09:05:52 -0500 Subject: [PATCH] DOC: sparse doc fixups --- doc/source/user_guide/sparse.rst | 2 +- doc/source/whatsnew/v0.16.0.rst | 2 ++ doc/source/whatsnew/v0.18.1.rst | 2 ++ doc/source/whatsnew/v0.19.0.rst | 2 ++ doc/source/whatsnew/v0.20.0.rst | 1 + pandas/core/sparse/frame.py | 2 +- pandas/core/sparse/series.py | 2 +- 7 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/source/user_guide/sparse.rst b/doc/source/user_guide/sparse.rst index 8fed29d7a6316..09ed895a847ff 100644 --- a/doc/source/user_guide/sparse.rst +++ b/doc/source/user_guide/sparse.rst @@ -269,7 +269,7 @@ have no replacement. Interaction with scipy.sparse ----------------------------- -Use :meth:`DataFrame.sparse.from_coo` to create a ``DataFrame`` with sparse values from a sparse matrix. +Use :meth:`DataFrame.sparse.from_spmatrix` to create a ``DataFrame`` with sparse values from a sparse matrix. .. versionadded:: 0.25.0 diff --git a/doc/source/whatsnew/v0.16.0.rst b/doc/source/whatsnew/v0.16.0.rst index 1e4ec682f0504..2cb09325c9466 100644 --- a/doc/source/whatsnew/v0.16.0.rst +++ b/doc/source/whatsnew/v0.16.0.rst @@ -92,6 +92,7 @@ Interaction with scipy.sparse Added :meth:`SparseSeries.to_coo` and :meth:`SparseSeries.from_coo` methods (:issue:`8048`) for converting to and from ``scipy.sparse.coo_matrix`` instances (see :ref:`here `). For example, given a SparseSeries with MultiIndex we can convert to a `scipy.sparse.coo_matrix` by specifying the row and column labels as index levels: .. ipython:: python + :okwarning: s = pd.Series([3.0, np.nan, 1.0, 3.0, np.nan, np.nan]) s.index = pd.MultiIndex.from_tuples([(1, 2, 'a', 0), @@ -121,6 +122,7 @@ The from_coo method is a convenience method for creating a ``SparseSeries`` from a ``scipy.sparse.coo_matrix``: .. ipython:: python + :okwarning: from scipy import sparse A = sparse.coo_matrix(([3.0, 1.0, 2.0], ([1, 0, 0], [0, 2, 3])), diff --git a/doc/source/whatsnew/v0.18.1.rst b/doc/source/whatsnew/v0.18.1.rst index f099ccf284bc2..069395c2e0f36 100644 --- a/doc/source/whatsnew/v0.18.1.rst +++ b/doc/source/whatsnew/v0.18.1.rst @@ -394,6 +394,7 @@ used in the ``pandas`` implementation (:issue:`12644`, :issue:`12638`, :issue:`1 An example of this signature augmentation is illustrated below: .. ipython:: python + :okwarning: sp = pd.SparseDataFrame([1, 2, 3]) sp @@ -409,6 +410,7 @@ Previous behaviour: New behaviour: .. ipython:: python + :okwarning: np.cumsum(sp, axis=0) diff --git a/doc/source/whatsnew/v0.19.0.rst b/doc/source/whatsnew/v0.19.0.rst index 29eeb415e2f6d..de29a1eb93709 100644 --- a/doc/source/whatsnew/v0.19.0.rst +++ b/doc/source/whatsnew/v0.19.0.rst @@ -1236,6 +1236,7 @@ Operators now preserve dtypes - Sparse data structure now can preserve ``dtype`` after arithmetic ops (:issue:`13848`) .. ipython:: python + :okwarning: s = pd.SparseSeries([0, 2, 0, 1], fill_value=0, dtype=np.int64) s.dtype @@ -1245,6 +1246,7 @@ Operators now preserve dtypes - Sparse data structure now support ``astype`` to convert internal ``dtype`` (:issue:`13900`) .. ipython:: python + :okwarning: s = pd.SparseSeries([1., 0., 2., 0.], fill_value=0) s diff --git a/doc/source/whatsnew/v0.20.0.rst b/doc/source/whatsnew/v0.20.0.rst index 741aa6ca143bb..6a88a5810eca4 100644 --- a/doc/source/whatsnew/v0.20.0.rst +++ b/doc/source/whatsnew/v0.20.0.rst @@ -339,6 +339,7 @@ See the :ref:`documentation ` for more information. (:issue: All sparse formats are supported, but matrices that are not in :mod:`COOrdinate ` format will be converted, copying data as needed. .. ipython:: python + :okwarning: from scipy.sparse import csr_matrix arr = np.random.random(size=(1000, 5)) diff --git a/pandas/core/sparse/frame.py b/pandas/core/sparse/frame.py index fa3cd781eaf88..bf1cec7571f4d 100644 --- a/pandas/core/sparse/frame.py +++ b/pandas/core/sparse/frame.py @@ -42,7 +42,7 @@ class SparseDataFrame(DataFrame): DataFrame containing sparse floating point data in the form of SparseSeries objects - .. deprectaed:: 0.25.0 + .. deprecated:: 0.25.0 Use a DataFrame with sparse values instead. diff --git a/pandas/core/sparse/series.py b/pandas/core/sparse/series.py index e4f8579a398dd..3f95acdbfb42c 100644 --- a/pandas/core/sparse/series.py +++ b/pandas/core/sparse/series.py @@ -46,7 +46,7 @@ class SparseSeries(Series): """Data structure for labeled, sparse floating point data - .. deprectaed:: 0.25.0 + .. deprecated:: 0.25.0 Use a Series with sparse values instead.