pandas.Series.describe#
- Series.describe(percentiles=None, include=None, exclude=None)[source]#
Generate descriptive statistics.
Summarize the central tendency, dispersion, and shape of the Series’s distribution, excluding
NaNvalues. The set of statistics returned depends on the Series’s dtype; see Notes.- Parameters:
- percentileslist-like of numbers, optional
The percentiles to include in the output. All should fall between 0 and 1. The default,
None, returns the 25th, 50th, and 75th percentiles.- includeNone
Has no effect on Series. Deprecated and will be removed in a future version.
- excludeNone
Has no effect on Series. Deprecated and will be removed in a future version.
- Returns:
- Series
Summary statistics of the Series.
See also
DataFrame.describeGenerate descriptive statistics of a DataFrame.
Series.countCount of non-NA observations.
Series.maxMaximum of the values.
Series.minMinimum of the values.
Series.meanMean of the values.
Series.stdStandard deviation of the observations.
Notes
For numeric dtypes, the result’s index includes
count,mean,std,min,max, and the requested percentiles. By default the lower percentile is25and the upper is75; the50percentile is the same as the median.For object dtypes (e.g. strings), the result’s index includes
count,unique,top, andfreq. Thetopis the most common value andfreqis its count. If multiple values tie for the highest count,topis chosen arbitrarily from among them.For datetime dtypes, the result also includes
meanand the requested percentiles, computed on the underlying timestamps.Examples
A numeric Series.
>>> s = pd.Series([1, 2, 3]) >>> s.describe() count 3.0 mean 2.0 std 1.0 min 1.0 25% 1.5 50% 2.0 75% 2.5 max 3.0 dtype: float64
An object Series.
>>> s = pd.Series(["a", "a", "b", "c"]) >>> s.describe() count 4 unique 3 top a freq 2 dtype: object
A datetime Series.
>>> s = pd.Series( ... [ ... np.datetime64("2000-01-01"), ... np.datetime64("2010-01-01"), ... np.datetime64("2010-01-01"), ... ] ... ) >>> s.describe() count 3 mean 2006-09-01 08:00:00 min 2000-01-01 00:00:00 25% 2004-12-31 12:00:00 50% 2010-01-01 00:00:00 75% 2010-01-01 00:00:00 max 2010-01-01 00:00:00 dtype: object