{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "aa1bb64d", "metadata": {}, "outputs": [], "source": [ "import folium\n", "import numpy as np\n", "import pandas as pd\n", "import json\n", "import requests" ] }, { "cell_type": "markdown", "id": "c7fd1292", "metadata": {}, "source": [ "# Integrating Jenks Natural Break Optimization\n", "\n", "Choropleths provide an easy way to visually see data distributions across geography. By default, folium uses the breaks created by numpy.histogram (np.histogram), which generally creates an evenly spaced quantiles.\n", "\n", "This works well enough for evenly distributed data, but for unevenly distributed data, these even quantiles can obscure more than they show. To demonstrate this, I have created maps showing the labor force of each US state.\n", "\n", "The data was taken from the county-level data and aggregated. Since our geographic data does not have areas representing Puerto Rico or the United States as a whole, I removed those entries while keeping Washington, D.C. in our data set. Already, looking at the first five states alphabetically, we can see that Alaska (AK) has a work force roughly 2% the size of California (CA)." ] }, { "cell_type": "code", "execution_count": 2, "id": "a199cc25", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | State | \n", "Civilian_labor_force_2011 | \n", "
---|---|---|
0 | \n", "AK | \n", "734088 | \n", "
1 | \n", "AL | \n", "4381044 | \n", "
2 | \n", "AR | \n", "2739713 | \n", "
3 | \n", "AZ | \n", "6068526 | \n", "
4 | \n", "CA | \n", "36769777 | \n", "