Skip to content

Commit ac9ec95

Browse files
oktaysabakproost
authored andcommitted
DOC: fix code-block in the reshaping docs (pandas-dev#28838)
1 parent c659785 commit ac9ec95

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

doc/source/user_guide/reshaping.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -728,14 +728,14 @@ Suppose we wanted to pivot ``df`` such that the ``col`` values are columns,
728728
``row`` values are the index, and the mean of ``val0`` are the values? In
729729
particular, the resulting DataFrame should look like:
730730

731-
.. note::
732-
733-
col col0 col1 col2 col3 col4
734-
row
735-
row0 0.77 0.605 NaN 0.860 0.65
736-
row2 0.13 NaN 0.395 0.500 0.25
737-
row3 NaN 0.310 NaN 0.545 NaN
738-
row4 NaN 0.100 0.395 0.760 0.24
731+
.. code-block:: text
732+
733+
col col0 col1 col2 col3 col4
734+
row
735+
row0 0.77 0.605 NaN 0.860 0.65
736+
row2 0.13 NaN 0.395 0.500 0.25
737+
row3 NaN 0.310 NaN 0.545 NaN
738+
row4 NaN 0.100 0.395 0.760 0.24
739739
740740
This solution uses :func:`~pandas.pivot_table`. Also note that
741741
``aggfunc='mean'`` is the default. It is included here to be explicit.

0 commit comments

Comments
 (0)