Skip to content

DOC: sparse doc fixups #26571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/user_guide/sparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions doc/source/whatsnew/v0.16.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sparse.scipysparse>`). 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),
Expand Down Expand Up @@ -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])),
Expand Down
2 changes: 2 additions & 0 deletions doc/source/whatsnew/v0.18.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -409,6 +410,7 @@ Previous behaviour:
New behaviour:

.. ipython:: python
:okwarning:

np.cumsum(sp, axis=0)

Expand Down
2 changes: 2 additions & 0 deletions doc/source/whatsnew/v0.19.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,7 @@ Operators now preserve dtypes
- Sparse data structure now can preserve ``dtype`` after arithmetic ops (:issue:`13848`)

.. ipython:: python
:okwarning:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better to make these code blocks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably. I'm still hoping someone will write a script to do this automatically someday. Just capture the output and freeze that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still hoping someone will write a script to do this automatically someday. Just capture the output and freeze that.

That's also my long term plan ;)
It sounds as not too hard, but sphinx keeps being a mystery most of the time ..


s = pd.SparseSeries([0, 2, 0, 1], fill_value=0, dtype=np.int64)
s.dtype
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.20.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ See the :ref:`documentation <sparse.scipysparse>` for more information. (:issue:
All sparse formats are supported, but matrices that are not in :mod:`COOrdinate <scipy.sparse>` format will be converted, copying data as needed.

.. ipython:: python
:okwarning:

from scipy.sparse import csr_matrix
arr = np.random.random(size=(1000, 5))
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/sparse/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/sparse/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down