Summarize data
get_summaryAggregate education data by group with counts, sums, averages. Handles multi-year trends in one call, returning complete results or refusing invalid groupings.
Instructions
Aggregate a dataset server-side: counts, sums, averages by group. Use this rather than get_data whenever the question is about totals ("how many schools per state", "total enrollment by race").
EVERY year comes back in one call — results are grouped by year on top of
by, so a trend needs one call, never one per year. Filter years only to
narrow a large result. Results are COMPLETE or refused. The API cannot rank
aggregates, and refuses groupings that produce too many groups (by=leaid
nationally, for instance).
var and by are drawn from two different pools — describe_dataset lists
both for any dataset. Guessing costs a slow round trip; reading them does not.
COST: this hits a live API and a broad aggregation can take 30s+.
NO COUNTY AGGREGATION for schools or districts. Several datasets return
county_code as a column, but it is neither filterable nor groupable, so
county totals cannot be computed here — fetch the rows with get_data and
aggregate them yourself, or say the portal does not support it. Do not
retry with county in by.
Args: path: The SUMMARY path — no year, no {placeholders}, e.g. "schools/ccd/enrollment". describe_dataset prints the right one for any dataset. Some differ from the data path ("college-university/ipeds/fall-enrollment/race"). var: The measure to aggregate — a numeric, non-filter variable stat: sum, count, avg, min, max, median, stddev, or variance by: Comma-separated groupings — "fips", "fips,race". May also use variables from the source's directory ("school_level", "sector"). filters: "fips=6" — omit year to get every year; "year=2018,2019,2020" to restrict the range
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| by | Yes | ||
| var | Yes | ||
| path | Yes | ||
| stat | Yes | ||
| filters | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |