Skip to content

Commit cb2f87d

Browse files
v0.15.0.rst: convert describe include example to plain code block
1 parent 2bd76b1 commit cb2f87d

File tree

1 file changed

+38
-9
lines changed

1 file changed

+38
-9
lines changed

doc/source/whatsnew/v0.15.0.rst

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,20 +1025,49 @@ Other:
10251025
- :func:`describe` on mixed-types DataFrames is more flexible. Type-based column filtering is now possible via the ``include``/``exclude`` arguments.
10261026
See the :ref:`docs <basics.describe>` (:issue:`8164`).
10271027

1028-
.. ipython:: python
1028+
.. code-block:: python
10291029
1030-
df = pd.DataFrame({'catA': ['foo', 'foo', 'bar'] * 8,
1031-
'catB': ['a', 'b', 'c', 'd'] * 6,
1032-
'numC': np.arange(24),
1033-
'numD': np.arange(24.) + .5})
1034-
df.describe(include=["object"])
1035-
df.describe(include=["number", "object"], exclude=["float"])
1030+
>>> df = pd.DataFrame({'catA': ['foo', 'foo', 'bar'] * 8,
1031+
... 'catB': ['a', 'b', 'c', 'd'] * 6,
1032+
... 'numC': np.arange(24),
1033+
... 'numD': np.arange(24.) + .5})
1034+
>>> df.describe(include=["object"])
1035+
catA catB
1036+
count 24 24
1037+
unique 2 4
1038+
top foo a
1039+
freq 16 6
1040+
>>> df.describe(include=["number", "object"], exclude=["float"])
1041+
catA catB numC
1042+
count 24 24 24.000000
1043+
unique 2 4 NaN
1044+
top foo a NaN
1045+
freq 16 6 NaN
1046+
mean NaN NaN 11.500000
1047+
std NaN NaN 7.071068
1048+
min NaN NaN 0.000000
1049+
25% NaN NaN 5.750000
1050+
50% NaN NaN 11.500000
1051+
75% NaN NaN 17.250000
1052+
max NaN NaN 23.000000
10361053
10371054
Requesting all columns is possible with the shorthand 'all'
10381055

1039-
.. ipython:: python
1056+
.. code-block:: python
10401057
1041-
df.describe(include='all')
1058+
>>> df.describe(include='all')
1059+
catA catB numC numD
1060+
count 24 24 24.000000 24.000000
1061+
unique 2 4 NaN NaN
1062+
top foo a NaN NaN
1063+
freq 16 6 NaN NaN
1064+
mean NaN NaN 11.500000 12.000000
1065+
std NaN NaN 7.071068 7.071068
1066+
min NaN NaN 0.000000 0.500000
1067+
25% NaN NaN 5.750000 6.250000
1068+
50% NaN NaN 11.500000 12.000000
1069+
75% NaN NaN 17.250000 17.750000
1070+
max NaN NaN 23.000000 23.500000
10421071
10431072
Without those arguments, ``describe`` will behave as before, including only numerical columns or, if none are, only categorical columns. See also the :ref:`docs <basics.describe>`
10441073

0 commit comments

Comments
 (0)