Frequency Table Reference
Frequency Table Reference
A frequency table groups source rows by one or more columns and counts the rows in each group. A pivot table extends this by breaking each group into sub-groups based on a pivot column. For tutorials and step-by-step workflows, see Grouping data and descriptive statistics.
Everything below also applies to PivotSheet (Shift+W).
Binning
Discrete Binning
By default, each unique formatted value in the grouped column becomes its own bin. Rows are sorted by count, descending.
Numeric Binning
Set options.numeric_binning to True to bin numeric columns into ranges.
options.histogram_binscontrols the number of bins. When set to 0 (default), the bin count is the square root of the row count.- Bin ranges display as "min - max".
- If all values are identical, a single bin is created.
- If there are more bins than distinct values, each value gets its own bin.
Errors and Nulls
Null and error values get their own bins. Error bins display as the stringified error value (e.g. #ERR).
Commands
On source sheet
Shift+F(freq-col): open Frequency Table grouped on current columng Shift+F(freq-keys): open Frequency Table grouped by all key columnsz Shift+F(freq-summary): open one-line summary for all rows and selected rowsShift+W(pivot): open Pivot Table: group rows by key columns and summarize current column
On Frequency Table
Enter(open-row): open copy of source sheet with rows in the current bing Enter(dive-selected): open copy of source sheet with rows from all selected binsz Enter(dive-except): open copy of source sheet excluding rows in the current bingz Enter(dive-except-selected): open copy of source sheet excluding rows in selected bins
Selection Propagation
Selecting rows on the frequency table also selects the corresponding source rows. Unselecting works the same way. Undoing selection changes on the frequency table will also undo them on the source sheet.
Columns
- Key columns from the grouped-by columns. Numeric binned columns use RangeColumn.
- count: number of source rows in the bin.
- percent: percentage of total source rows in the bin.
- histogram: visual bar chart (present when
disp_histogramis set). Hidden automatically when aggregation columns are added. - Aggregation columns: one column per aggregator set on source columns (via
+).
Options
options.disp_histogram(default:■): histogram element characteroptions.histogram_bins(default:0): number of bins for histogram of numeric columns (0 = auto)options.numeric_binning(default:False): bin numeric columns into ranges
Tips
g '(freeze-sheet) to create a plain data sheet snapshot of the frequency table.- Add aggregators on source columns with
+before opening the frequency table to see summary statistics per bin.
Internals
Row Type
Each row is a PivotGroupRow namedtuple with these components:
discrete_keys: tuple of formatted values for discrete key columnsnumeric_key: range tuple(min, max)for numeric bins, or(0, 0)if not binnedsourcerows: list of source rows in this grouppivotrows: dict mapping pivot values to lists of source rows
Architecture
FreqTableSheetinherits fromPivotSheet.groupRows()iterates source rows, assigns each to a bin by its formatted key values, and populatessourcerowsandpivotrows.addAggregateCols()creates aggregation columns from any aggregators set on source columns.nonKeyVisibleColsdetermines which columns receive aggregation caching after load.
Pivot-Specific
pivotrowsdict maps pivot values to row lists for each group.Column.aggvaluestores which pivot value a column represents.
Key Source Files
visidata/freqtbl.py— FreqTableSheet, HistogramColumn, commandsvisidata/pivot.py— PivotSheet, PivotGroupRow, RangeColumn, groupRows, addAggregateColsvisidata/aggregators.py— aggregator definitions
