Skip to content

Commit 916624c

Browse files
committed
DOC: Improve the docstring of DataFrame.describe()
1 parent d7bcb22 commit 916624c

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed

pandas/core/generic.py

+37-36
Original file line numberDiff line numberDiff line change
@@ -7179,7 +7179,7 @@ def abs(self):
71797179

71807180
def describe(self, percentiles=None, include=None, exclude=None):
71817181
"""
7182-
Generates descriptive statistics that summarize the central tendency,
7182+
Generate descriptive statistics that summarize the central tendency,
71837183
dispersion and shape of a dataset's distribution, excluding
71847184
``NaN`` values.
71857185
@@ -7267,6 +7267,7 @@ def describe(self, percentiles=None, include=None, exclude=None):
72677267
50% 2.0
72687268
75% 2.5
72697269
max 3.0
7270+
dtype: float64
72707271
72717272
Describing a categorical ``Series``.
72727273
@@ -7315,18 +7316,18 @@ def describe(self, percentiles=None, include=None, exclude=None):
73157316
Describing all columns of a ``DataFrame`` regardless of data type.
73167317
73177318
>>> df.describe(include='all')
7318-
categorical numeric object
7319-
count 3 3.0 3
7320-
unique 3 NaN 3
7321-
top f NaN c
7322-
freq 1 NaN 1
7323-
mean NaN 2.0 NaN
7324-
std NaN 1.0 NaN
7325-
min NaN 1.0 NaN
7326-
25% NaN 1.5 NaN
7327-
50% NaN 2.0 NaN
7328-
75% NaN 2.5 NaN
7329-
max NaN 3.0 NaN
7319+
object numeric categorical
7320+
count 3 3.0 3
7321+
unique 3 NaN 3
7322+
top c NaN f
7323+
freq 1 NaN 1
7324+
mean NaN 2.0 NaN
7325+
std NaN 1.0 NaN
7326+
min NaN 1.0 NaN
7327+
25% NaN 1.5 NaN
7328+
50% NaN 2.0 NaN
7329+
75% NaN 2.5 NaN
7330+
max NaN 3.0 NaN
73307331
73317332
Describing a column from a ``DataFrame`` by accessing it as
73327333
an attribute.
@@ -7376,36 +7377,36 @@ def describe(self, percentiles=None, include=None, exclude=None):
73767377
Excluding numeric columns from a ``DataFrame`` description.
73777378
73787379
>>> df.describe(exclude=[np.number])
7379-
categorical object
7380-
count 3 3
7381-
unique 3 3
7382-
top f c
7383-
freq 1 1
7380+
object categorical
7381+
count 3 3
7382+
unique 3 3
7383+
top c f
7384+
freq 1 1
73847385
73857386
Excluding object columns from a ``DataFrame`` description.
73867387
73877388
>>> df.describe(exclude=[np.object])
7388-
categorical numeric
7389-
count 3 3.0
7390-
unique 3 NaN
7391-
top f NaN
7392-
freq 1 NaN
7393-
mean NaN 2.0
7394-
std NaN 1.0
7395-
min NaN 1.0
7396-
25% NaN 1.5
7397-
50% NaN 2.0
7398-
75% NaN 2.5
7399-
max NaN 3.0
7389+
numeric categorical
7390+
count 3.0 3
7391+
unique NaN 3
7392+
top NaN f
7393+
freq NaN 1
7394+
mean 2.0 NaN
7395+
std 1.0 NaN
7396+
min 1.0 NaN
7397+
25% 1.5 NaN
7398+
50% 2.0 NaN
7399+
75% 2.5 NaN
7400+
max 3.0 NaN
74007401
74017402
See Also
74027403
--------
7403-
DataFrame.count
7404-
DataFrame.max
7405-
DataFrame.min
7406-
DataFrame.mean
7407-
DataFrame.std
7408-
DataFrame.select_dtypes
7404+
DataFrame.count : Count number of non-NA/null observations
7405+
DataFrame.max : Maximum of the values in the object
7406+
DataFrame.min : Minimum of the values in the object
7407+
DataFrame.mean : Mean of the values
7408+
DataFrame.std : Standard deviation of the obersvations
7409+
DataFrame.select_dtypes : Subset of a DataFrame including/excluding columns based on their dtype
74097410
"""
74107411
if self.ndim >= 3:
74117412
msg = "describe is not implemented on Panel objects."

0 commit comments

Comments
 (0)