Skip to content

Commit e2800fa

Browse files
nehiljainjreback
authored andcommitted
DOC: Improve the docstring of DataFrame.describe() (#20222)
1 parent 9fd7db5 commit e2800fa

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

pandas/core/generic.py

+18-15
Original file line numberDiff line numberDiff line change
@@ -8348,7 +8348,7 @@ def abs(self):
83488348

83498349
def describe(self, percentiles=None, include=None, exclude=None):
83508350
"""
8351-
Generates descriptive statistics that summarize the central tendency,
8351+
Generate descriptive statistics that summarize the central tendency,
83528352
dispersion and shape of a dataset's distribution, excluding
83538353
``NaN`` values.
83548354
@@ -8392,7 +8392,18 @@ def describe(self, percentiles=None, include=None, exclude=None):
83928392
83938393
Returns
83948394
-------
8395-
summary: Series/DataFrame of summary statistics
8395+
Series or DataFrame
8396+
Summary statistics of the Series or Dataframe provided.
8397+
8398+
See Also
8399+
--------
8400+
DataFrame.count: Count number of non-NA/null observations.
8401+
DataFrame.max: Maximum of the values in the object.
8402+
DataFrame.min: Minimum of the values in the object.
8403+
DataFrame.mean: Mean of the values.
8404+
DataFrame.std: Standard deviation of the obersvations.
8405+
DataFrame.select_dtypes: Subset of a DataFrame including/excluding
8406+
columns based on their dtype.
83968407
83978408
Notes
83988409
-----
@@ -8436,6 +8447,7 @@ def describe(self, percentiles=None, include=None, exclude=None):
84368447
50% 2.0
84378448
75% 2.5
84388449
max 3.0
8450+
dtype: float64
84398451
84408452
Describing a categorical ``Series``.
84418453
@@ -8466,9 +8478,9 @@ def describe(self, percentiles=None, include=None, exclude=None):
84668478
Describing a ``DataFrame``. By default only numeric fields
84678479
are returned.
84688480
8469-
>>> df = pd.DataFrame({ 'object': ['a', 'b', 'c'],
8470-
... 'numeric': [1, 2, 3],
8471-
... 'categorical': pd.Categorical(['d','e','f'])
8481+
>>> df = pd.DataFrame({'categorical': pd.Categorical(['d','e','f']),
8482+
... 'numeric': [1, 2, 3],
8483+
... 'object': ['a', 'b', 'c']
84728484
... })
84738485
>>> df.describe()
84748486
numeric
@@ -8554,7 +8566,7 @@ def describe(self, percentiles=None, include=None, exclude=None):
85548566
Excluding object columns from a ``DataFrame`` description.
85558567
85568568
>>> df.describe(exclude=[np.object])
8557-
categorical numeric
8569+
categorical numeric
85588570
count 3 3.0
85598571
unique 3 NaN
85608572
top f NaN
@@ -8566,15 +8578,6 @@ def describe(self, percentiles=None, include=None, exclude=None):
85668578
50% NaN 2.0
85678579
75% NaN 2.5
85688580
max NaN 3.0
8569-
8570-
See Also
8571-
--------
8572-
DataFrame.count
8573-
DataFrame.max
8574-
DataFrame.min
8575-
DataFrame.mean
8576-
DataFrame.std
8577-
DataFrame.select_dtypes
85788581
"""
85798582
if self.ndim >= 3:
85808583
msg = "describe is not implemented on Panel objects."

0 commit comments

Comments
 (0)