histogram

statistics

Creates a histogram of value distributions

Syntax

histogram(array|dataframe, bins?)

Parameters

array|dataframe (array or dataframe)

The data to create a histogram from

bins (number) optional

Number of bins to use (optional, auto-calculated if not provided)

Returns

object

Histogram data showing distribution of values across bins

Examples

Age distribution in 10 bins
Input:
.age | histogram(10)
Output:
[{"bin": "0-10", "count": 5}, {"bin": "10-20", "count": 12}, ...]
Price distribution with automatic bins
Input:
.price | histogram
Output:
[{"bin": "0-50", "count": 23}, {"bin": "50-100", "count": 45}, ...]

The histogram() function creates a histogram showing the distribution of values across bins (ranges).

Usage

Use histogram() to visualize data distribution, identify patterns, and understand the frequency of values across different ranges.