Compare ZIPs
compare_zipsRank multiple US ZIP codes by a chosen IRS statistic, from highest to lowest value. Missing or suppressed data is handled with clear indicators.
Instructions
Rank several ZIPs by a single metric, highest value first.
`zips`: a list of 5-digit US ZIPs to compare. `metric`: one of
`total_returns`, `adjusted_gross_income`, `avg_agi_per_return`,
`pct_returns_200k_plus`, `total_income`, `salaries_and_wages`, `income_tax`,
`total_tax_liability`, `avg_total_tax_per_return`, `eitc_amount`. Returns each
ZIP's value, sorted descending; ZIPs with no SOI data are listed last. A 0
for a sparse metric (e.g. `eitc_amount`) may be IRS-suppressed, not a true
zero.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| zips | Yes | ||
| metric | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| metric | Yes | The compared metric's name | |
| results | Yes | One entry per requested ZIP, sorted by value descending; ZIPs with no data are listed last | |
| tax_year | Yes | SOI tax year of the data |