{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "b313a218-4778-4d5b-9036-f0370d4212a0", "metadata": {}, "outputs": [], "source": [ "import ibis\n", "from ibis import _\n", "conn = ibis.duckdb.connect(extensions=[\"spatial\"])" ] }, { "cell_type": "code", "execution_count": 73, "id": "fbbd28ea-f1e3-4f3d-ab99-a2ae9b04f3d4", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "74" ] }, "execution_count": 73, "metadata": {}, "output_type": "execute_result" } ], "source": [ "state_boundaries = \"https://data.source.coop/cboettig/us-boundaries/us-state-territory.parquet\"\n", "county_boundaries = \"https://data.source.coop/cboettig/us-boundaries/us-county.parquet\"\n", "\n", "states = conn.read_parquet(state_boundaries).rename(state_id = \"STUSPS\", state = \"NAME\")\n", "county = conn.read_parquet(county_boundaries).rename(county = \"NAMELSAD\", state = \"STATE_NAME\")\n", "\n", "votes = conn.read_csv(\"measures.csv\")\n", "#votes.execute()\n", "votes.count().execute()" ] }, { "cell_type": "code", "execution_count": 74, "id": "f766d5ea-1a1b-4113-b985-f2014c8935c9", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Jurisdiction Type | \n", "n | \n", "
---|---|---|
0 | \n", "County | \n", "23 | \n", "
1 | \n", "Municipal | \n", "48 | \n", "
2 | \n", "Special District | \n", "1 | \n", "
3 | \n", "State | \n", "2 | \n", "