Initializing playground…
← Back to roadmap

📈 describe & quantile — Interactive Playground

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.

1 · Describe a numeric Series

Pass any Series with numeric data and get back a labeled Series of statistics. Percentiles default to 25%, 50%, and 75% — just like pandas.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

2 · Custom percentiles

Override the default percentile set with the percentiles option. Pass any array of values in [0, 1].

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

3 · Describe a categorical Series

For non-numeric Series, describe() switches to categorical mode: count, unique, top (most frequent value), and freq (its count). Nulls are silently excluded.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

4 · Describe a DataFrame

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").

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

5 · include="all" for mixed DataFrames

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.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

6 · Series.quantile()

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.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

7 · Standalone quantile() utility

The low-level quantile(sorted, q) function works on any sorted plain array and is useful when you have pre-filtered data.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

API Reference

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