Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a FrequencyTable Guide #2534

Merged
merged 8 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion visidata/aggregators.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def _fmt_aggr_summary(match, row, trigger_key):
vd.warning(f'aggregator does not exist: {aggr}')
return aggrs

Sheet.addCommand('+', 'aggregate-col', 'addAggregators([cursorCol], chooseAggregators())', 'Add aggregator to current column')
Sheet.addCommand('+', 'aggregate-col', 'addAggregators([cursorCol], chooseAggregators())', 'add aggregator to current column')
Sheet.addCommand('z+', 'memo-aggregate', 'cursorCol.memo_aggregate(chooseAggregators(), selectedRows or rows)', 'memo result of aggregator over values in selected rows for current column')
ColumnsSheet.addCommand('g+', 'aggregate-cols', 'addAggregators(selectedRows or source[0].nonKeyVisibleCols, chooseAggregators())', 'add aggregators to selected source columns')

Expand Down
42 changes: 42 additions & 0 deletions visidata/guides/FrequencyTable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Frequency Tables are how you GROUP BY

Frequency Tables group rows into bins by column value, and includes summary columns for source columns with aggregators.

Set `--numeric-binning` to bin numeric rows into ranges instead of discrete values.

- {help.commands.freq_col}

- {help.commands.freq_keys}

- {help.commands.freq_summary}

## Aggregators

A **Frequency Table** contains a summary columns for each aggregator added to a source column.
These aggregators need to be added before creating the Frequency Table.
Examples of aggregators include min, max, sum, distinct, count, and list.

- {help.commands.aggregate-col}

Note: set an appropriate type for the aggregator target column, for example {help.commands.type_float}.

## Explore the data

Dive into a group to see the underlying row(s) using the **Frequency Table**:

- {help.commands.open_row}
- {help.commands.dive_selected}

Select a group to select all of its underlying rows in the source sheet.

## Using Split Panes with Frequency Tables

Press `Shift+Z` to open a split pane, and then `Shift+F` to create a **Frequency Table**. The **Frequency Table** will automatically open in the other pane.

See the `SplitpanesGuide` for more.

#### Options

- {help.options.disp_histogram}
- {help.options.histogram_bins}
- {help.options.numeric_binning}
Loading