You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/user_guide/sparse.rst
+10-10
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ array that are ``nan`` aren't actually stored, only the non-``nan`` elements are
23
23
Those non-``nan`` elements have a ``float64`` dtype.
24
24
25
25
The sparse objects exist for memory efficiency reasons. Suppose you had a
26
-
large, mostly NA ``DataFrame``:
26
+
large, mostly NA :class:`DataFrame`:
27
27
28
28
.. ipython:: python
29
29
@@ -139,7 +139,7 @@ Sparse calculation
139
139
------------------
140
140
141
141
You can apply NumPy `ufuncs <https://numpy.org/doc/stable/reference/ufuncs.html>`_
142
-
to ``SparseArray`` and get a ``SparseArray`` as a result.
142
+
to :class:`arrays.SparseArray` and get a :class:`arrays.SparseArray` as a result.
143
143
144
144
.. ipython:: python
145
145
@@ -183,7 +183,7 @@ your code, rather than ignoring the warning.
183
183
**Construction**
184
184
185
185
From an array-like, use the regular :class:`Series` or
186
-
:class:`DataFrame` constructors with :class:`SparseArray` values.
186
+
:class:`DataFrame` constructors with :class:`arrays.SparseArray` values.
187
187
188
188
.. code-block:: python
189
189
@@ -240,7 +240,7 @@ Sparse-specific properties, like ``density``, are available on the ``.sparse`` a
240
240
**General differences**
241
241
242
242
In a ``SparseDataFrame``, *all* columns were sparse. A :class:`DataFrame` can have a mixture of
243
-
sparse and dense columns. As a consequence, assigning new columns to a ``DataFrame`` with sparse
243
+
sparse and dense columns. As a consequence, assigning new columns to a :class:`DataFrame` with sparse
244
244
values will not automatically convert the input to be sparse.
245
245
246
246
.. code-block:: python
@@ -269,7 +269,7 @@ have no replacement.
269
269
Interaction with scipy.sparse
270
270
-----------------------------
271
271
272
-
Use :meth:`DataFrame.sparse.from_spmatrix` to create a ``DataFrame`` with sparse values from a sparse matrix.
272
+
Use :meth:`DataFrame.sparse.from_spmatrix` to create a :class:`DataFrame` with sparse values from a sparse matrix.
273
273
274
274
.. versionadded:: 0.25.0
275
275
@@ -294,9 +294,9 @@ To convert back to sparse SciPy matrix in COO format, you can use the :meth:`Dat
294
294
295
295
sdf.sparse.to_coo()
296
296
297
-
:meth:`Series.sparse.to_coo` is implemented for transforming a ``Series`` with sparse values indexed by a :class:`MultiIndex` to a :class:`scipy.sparse.coo_matrix`.
297
+
:meth:`Series.sparse.to_coo` is implemented for transforming a :class:`Series` with sparse values indexed by a :class:`MultiIndex` to a :class:`scipy.sparse.coo_matrix`.
298
298
299
-
The method requires a ``MultiIndex`` with two or more levels.
299
+
The method requires a :class:`MultiIndex` with two or more levels.
300
300
301
301
.. ipython:: python
302
302
@@ -315,7 +315,7 @@ The method requires a ``MultiIndex`` with two or more levels.
315
315
ss = s.astype('Sparse')
316
316
ss
317
317
318
-
In the example below, we transform the ``Series`` to a sparse representation of a 2-d array by specifying that the first and second ``MultiIndex`` levels define labels for the rows and the third and fourth levels define labels for the columns. We also specify that the column and row labels should be sorted in the final sparse representation.
318
+
In the example below, we transform the :class:`Series` to a sparse representation of a 2-d array by specifying that the first and second ``MultiIndex`` levels define labels for the rows and the third and fourth levels define labels for the columns. We also specify that the column and row labels should be sorted in the final sparse representation.
319
319
320
320
.. ipython:: python
321
321
@@ -341,7 +341,7 @@ Specifying different row and column labels (and not sorting them) yields a diffe
341
341
rows
342
342
columns
343
343
344
-
A convenience method :meth:`Series.sparse.from_coo` is implemented for creating a ``Series`` with sparse values from a ``scipy.sparse.coo_matrix``.
344
+
A convenience method :meth:`Series.sparse.from_coo` is implemented for creating a :class:`Series` with sparse values from a ``scipy.sparse.coo_matrix``.
345
345
346
346
.. ipython:: python
347
347
@@ -350,7 +350,7 @@ A convenience method :meth:`Series.sparse.from_coo` is implemented for creating
350
350
A
351
351
A.todense()
352
352
353
-
The default behaviour (with ``dense_index=False``) simply returns a ``Series`` containing
353
+
The default behaviour (with ``dense_index=False``) simply returns a :class:`Series` containing
0 commit comments