Skip to content

Commit 13d30d2

Browse files
committed
fixup
1 parent 706c5dc commit 13d30d2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

doc/source/user_guide/sparse.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,12 @@ In a SparseDataFrame, *all* columns were sparse. A :class:`DataFrame` can have a
237237
sparse and dense columns. As a consequence, assigning new columns to a DataFrame with sparse
238238
values will not automatically convert the input to be sparse.
239239

240-
.. code-block::
240+
.. code-block:: python
241241
242242
# Previous Way
243-
df = pd.SparseDataFrame({"A": [0, 1]})
244-
df['B'] = [0, 0] # implicitly becomes Sparse
245-
df['B'].dtype
243+
>>> df = pd.SparseDataFrame({"A": [0, 1]})
244+
>>> df['B'] = [0, 0] # implicitly becomes Sparse
245+
>>> df['B'].dtype
246246
Sparse[int64, nan]
247247
248248
Instead, you'll need to ensure that the values being assigned are sparse

0 commit comments

Comments
 (0)