describe() and Series.quantile() give you the
same concise statistical summary that
pandas.DataFrame.describe() produces. For numeric data you get
count, mean, std, min, percentiles, and
max. For categorical data you get count, unique,
top, and freq.
Edit any code block below and press ▶ Run
(or Ctrl+Enter) to execute it live in your browser.
Pass any Series with numeric data and get back a labeled
Series of statistics. Percentiles default to 25%, 50%, and
75% — just like pandas.
Override the default percentile set with the percentiles
option. Pass any array of values in [0, 1].
For non-numeric Series, describe() switches to categorical
mode: count, unique, top (most frequent
value), and freq (its count). Nulls are silently excluded.
When passed a DataFrame, describe() returns a
new DataFrame where each column is a stat Series. By default
only numeric columns are included (include: "number").
Set include: "all" to describe both numeric and categorical
columns in a single call. Numeric stats get null for
categorical-only rows and vice-versa.
Series.quantile(q) computes a single quantile via linear
interpolation — the same algorithm pandas uses as its default
(method="linear"). q=0.5 is the median.
The low-level quantile(sorted, q) function works on any
sorted plain array and is useful when you have pre-filtered data.
describe() returns a summary Series (for Series
input) or DataFrame (for DataFrame input). quantile()
computes a single quantile from a sorted array or Series.
// Series describe
describe(series, {
percentiles?: number[], // default [0.25, 0.5, 0.75]
}): Series
// DataFrame describe
describe(df, {
percentiles?: number[],
include?: "number" | "all", // default "number"
}): DataFrame
// Series quantile
series.quantile(q: number): number
// Standalone quantile
quantile(sorted: number[], q: number): number