{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "b8c08034",
   "metadata": {},
   "source": [
    "# Is everything in Adelaide 20 minutes away?\n",
    "\n",
    "The drive from every Greater Adelaide mesh block to eight places, at the speed limit with no traffic (`free`), in\n",
    "TomTom's 2025 morning and evening rush-hour slowdown (`am`, `pm`), and by public transport arriving 8 to 9 am (`pt`).\n",
    "Made in [Plotlay](https://www.getplotlay.com). This notebook reads only `../data`.\n",
    "\n",
    "**Read it carefully.** The rush hour is a city-wide average slowdown, not a traffic forecast; the trips go to the\n",
    "nearest place of each kind and leave out parking."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e6a7538b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-11-17T23:42:46.941686Z",
     "iopub.status.busy": "2026-11-17T23:42:46.941572Z",
     "iopub.status.idle": "2026-11-17T23:42:47.330333Z",
     "shell.execute_reply": "2026-11-17T23:42:47.329605Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "15,797 mesh blocks, 1,386,882 residents\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "DATA = '../data'\n",
    "mb = pd.read_csv(f'{DATA}/mesh_block_minutes.csv', dtype={'mb_code': str, 'sa2_code': str})\n",
    "PLACES = ['cbd', 'beach', 'airport', 'hospital', 'uni', 'oval', 'hills', 'shops']\n",
    "total = mb.residents.sum()\n",
    "print(f'{len(mb):,} mesh blocks, {total:,.0f} residents')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "560207a0",
   "metadata": {},
   "source": [
    "## Within 20 minutes of each place\n",
    "\n",
    "A mesh block counts when its minutes are 20 or fewer; empty means not reached."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "5f1f3b64",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-11-17T23:42:47.332382Z",
     "iopub.status.busy": "2026-11-17T23:42:47.332257Z",
     "iopub.status.idle": "2026-11-17T23:42:47.346024Z",
     "shell.execute_reply": "2026-11-17T23:42:47.345450Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>free</th>\n",
       "      <th>am</th>\n",
       "      <th>pm</th>\n",
       "      <th>pt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>shops</th>\n",
       "      <td>99.4</td>\n",
       "      <td>97.6</td>\n",
       "      <td>97.5</td>\n",
       "      <td>37.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>hospital</th>\n",
       "      <td>93.5</td>\n",
       "      <td>79.1</td>\n",
       "      <td>77.0</td>\n",
       "      <td>4.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>uni</th>\n",
       "      <td>92.3</td>\n",
       "      <td>64.9</td>\n",
       "      <td>64.3</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>beach</th>\n",
       "      <td>61.9</td>\n",
       "      <td>40.9</td>\n",
       "      <td>40.2</td>\n",
       "      <td>7.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>oval</th>\n",
       "      <td>51.3</td>\n",
       "      <td>23.9</td>\n",
       "      <td>22.2</td>\n",
       "      <td>1.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>cbd</th>\n",
       "      <td>48.3</td>\n",
       "      <td>21.5</td>\n",
       "      <td>20.0</td>\n",
       "      <td>2.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>airport</th>\n",
       "      <td>39.6</td>\n",
       "      <td>15.1</td>\n",
       "      <td>14.1</td>\n",
       "      <td>0.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>hills</th>\n",
       "      <td>24.6</td>\n",
       "      <td>8.6</td>\n",
       "      <td>8.4</td>\n",
       "      <td>0.2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          free    am    pm    pt\n",
       "shops     99.4  97.6  97.5  37.4\n",
       "hospital  93.5  79.1  77.0   4.7\n",
       "uni       92.3  64.9  64.3   5.0\n",
       "beach     61.9  40.9  40.2   7.1\n",
       "oval      51.3  23.9  22.2   1.2\n",
       "cbd       48.3  21.5  20.0   2.1\n",
       "airport   39.6  15.1  14.1   0.3\n",
       "hills     24.6   8.6   8.4   0.2"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def share(run, place, limit=20):\n",
    "    m = mb[f'{run}_{place}']\n",
    "    return (mb.residents * (m <= limit)).sum() / total\n",
    "table = pd.DataFrame({run: {p: share(run, p) for p in PLACES} for run in ['free', 'am', 'pm', 'pt']})\n",
    "(table * 100).round(1).sort_values('free', ascending=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8cdfd211",
   "metadata": {},
   "source": [
    "## All eight: the strict reading"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "e60efce5",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-11-17T23:42:47.347526Z",
     "iopub.status.busy": "2026-11-17T23:42:47.347413Z",
     "iopub.status.idle": "2026-11-17T23:42:47.353622Z",
     "shell.execute_reply": "2026-11-17T23:42:47.353221Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "free      10.1% within 20 minutes of all eight\n",
      "am         0.0% within 20 minutes of all eight\n",
      "pm         0.0% within 20 minutes of all eight\n",
      "typical   28.7% within 20 minutes of all eight\n",
      "pt         0.0% within 20 minutes of all eight\n"
     ]
    }
   ],
   "source": [
    "def all_eight(run, limit=20):\n",
    "    ok = pd.concat([mb[f'{run}_{p}'] <= limit for p in PLACES], axis=1).all(axis=1)\n",
    "    return (mb.residents * ok).sum() / total\n",
    "for run in ['free', 'am', 'pm', 'typical', 'pt']:\n",
    "    print(f'{run:8s} {all_eight(run) * 100:5.1f}% within 20 minutes of all eight')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "39e789f5",
   "metadata": {},
   "source": [
    "## How many of the eight: the headline is half or more (4 of 8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "20dec17d",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-11-17T23:42:47.355100Z",
     "iopub.status.busy": "2026-11-17T23:42:47.355010Z",
     "iopub.status.idle": "2026-11-17T23:42:47.368315Z",
     "shell.execute_reply": "2026-11-17T23:42:47.367779Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>free</th>\n",
       "      <th>am</th>\n",
       "      <th>pt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.3</td>\n",
       "      <td>1.4</td>\n",
       "      <td>53.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.7</td>\n",
       "      <td>4.7</td>\n",
       "      <td>38.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3.9</td>\n",
       "      <td>19.5</td>\n",
       "      <td>6.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>23.4</td>\n",
       "      <td>31.2</td>\n",
       "      <td>0.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>17.5</td>\n",
       "      <td>19.7</td>\n",
       "      <td>0.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>9.7</td>\n",
       "      <td>12.1</td>\n",
       "      <td>0.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>8.2</td>\n",
       "      <td>4.6</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>26.2</td>\n",
       "      <td>6.8</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>10.1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   free    am    pt\n",
       "0   0.3   1.4  53.8\n",
       "1   0.7   4.7  38.2\n",
       "2   3.9  19.5   6.0\n",
       "3  23.4  31.2   0.8\n",
       "4  17.5  19.7   0.5\n",
       "5   9.7  12.1   0.6\n",
       "6   8.2   4.6   0.0\n",
       "7  26.2   6.8   0.0\n",
       "8  10.1   0.0   0.0"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def counts(run): return sum((mb[f'{run}_{p}'] <= 20).astype(int) for p in PLACES)\n",
    "dist = pd.DataFrame({run: mb.groupby(counts(run)).residents.sum().reindex(range(9), fill_value=0) / total * 100 for run in ['free', 'am', 'pt']})\n",
    "dist.round(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "e1944a17",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-11-17T23:42:47.369626Z",
     "iopub.status.busy": "2026-11-17T23:42:47.369532Z",
     "iopub.status.idle": "2026-11-17T23:42:47.381096Z",
     "shell.execute_reply": "2026-11-17T23:42:47.380634Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "free     3+  95.2%   4+  71.8%   5+  54.2%   median 5 of 8\n",
      "am       3+  74.3%   4+  43.1%   5+  23.5%   median 3 of 8\n",
      "pm       3+  72.5%   4+  42.2%   5+  21.2%   median 3 of 8\n",
      "typical  3+  96.6%   4+  82.4%   5+  71.3%   median 7 of 8\n",
      "pt       3+   2.0%   4+   1.2%   5+   0.6%   median 0 of 8\n"
     ]
    }
   ],
   "source": [
    "for run in ['free', 'am', 'pm', 'typical', 'pt']:\n",
    "    c = counts(run)\n",
    "    o = c.sort_values(); w = mb.residents[o.index].cumsum(); median = o[w >= total / 2].iloc[0]\n",
    "    print(f\"{run:8s} 3+ {(mb.residents * (c >= 3)).sum() / total * 100:5.1f}%   4+ {(mb.residents * (c >= 4)).sum() / total * 100:5.1f}%   5+ {(mb.residents * (c >= 5)).sum() / total * 100:5.1f}%   median {median} of 8\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fabacae4",
   "metadata": {},
   "source": [
    "## Where it holds: areas where most residents have half the places or more"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "4abf6b00",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-11-17T23:42:47.382729Z",
     "iopub.status.busy": "2026-11-17T23:42:47.382623Z",
     "iopub.status.idle": "2026-11-17T23:42:47.391045Z",
     "shell.execute_reply": "2026-11-17T23:42:47.390510Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "71 of 102 areas hold at the speed limit; 42 in the rush hour\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>sa2_name</th>\n",
       "      <th>residents</th>\n",
       "      <th>share_half_free</th>\n",
       "      <th>share_half_am</th>\n",
       "      <th>places_within_20_free</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Goodwood - Millswood</td>\n",
       "      <td>17632</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.000</td>\n",
       "      <td>8.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Unley - Parkside</td>\n",
       "      <td>20956</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.000</td>\n",
       "      <td>8.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Colonel Light Gardens</td>\n",
       "      <td>15862</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.995</td>\n",
       "      <td>8.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Mitcham (SA)</td>\n",
       "      <td>16473</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.563</td>\n",
       "      <td>7.99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Adelaide</td>\n",
       "      <td>18223</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.000</td>\n",
       "      <td>7.91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Toorak Gardens</td>\n",
       "      <td>16635</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.000</td>\n",
       "      <td>7.67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Walkerville</td>\n",
       "      <td>7998</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.000</td>\n",
       "      <td>7.60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Beaumont - Glen Osmond</td>\n",
       "      <td>10320</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.790</td>\n",
       "      <td>7.57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Norwood (SA)</td>\n",
       "      <td>10854</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.000</td>\n",
       "      <td>7.55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Edwardstown</td>\n",
       "      <td>14552</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.000</td>\n",
       "      <td>7.52</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 sa2_name  residents  share_half_free  share_half_am  \\\n",
       "0    Goodwood - Millswood      17632              1.0          1.000   \n",
       "1        Unley - Parkside      20956              1.0          1.000   \n",
       "2   Colonel Light Gardens      15862              1.0          0.995   \n",
       "3            Mitcham (SA)      16473              1.0          0.563   \n",
       "4                Adelaide      18223              1.0          1.000   \n",
       "5          Toorak Gardens      16635              1.0          1.000   \n",
       "6             Walkerville       7998              1.0          1.000   \n",
       "7  Beaumont - Glen Osmond      10320              1.0          0.790   \n",
       "8            Norwood (SA)      10854              1.0          1.000   \n",
       "9             Edwardstown      14552              1.0          1.000   \n",
       "\n",
       "   places_within_20_free  \n",
       "0                   8.00  \n",
       "1                   8.00  \n",
       "2                   8.00  \n",
       "3                   7.99  \n",
       "4                   7.91  \n",
       "5                   7.67  \n",
       "6                   7.60  \n",
       "7                   7.57  \n",
       "8                   7.55  \n",
       "9                   7.52  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sa2 = pd.read_csv(f'{DATA}/sa2.csv', dtype={'sa2_code': str})\n",
    "big = sa2[sa2.residents >= 3000]\n",
    "print((big.share_half_free >= 0.5).sum(), 'of', len(big), 'areas hold at the speed limit;', (big.share_half_am >= 0.5).sum(), 'in the rush hour')\n",
    "big.sort_values(['share_half_free', 'places_within_20_free'], ascending=False)[['sa2_name', 'residents', 'share_half_free', 'share_half_am', 'places_within_20_free']].head(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "84631bf2",
   "metadata": {},
   "source": [
    "## Where it fails"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "8779fe34",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-11-17T23:42:47.392563Z",
     "iopub.status.busy": "2026-11-17T23:42:47.392458Z",
     "iopub.status.idle": "2026-11-17T23:42:47.396696Z",
     "shell.execute_reply": "2026-11-17T23:42:47.396174Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>sa2_name</th>\n",
       "      <th>residents</th>\n",
       "      <th>share_half_free</th>\n",
       "      <th>places_within_20_free</th>\n",
       "      <th>mean_min_city_free</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>108</th>\n",
       "      <td>Adelaide Hills</td>\n",
       "      <td>7032</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.01</td>\n",
       "      <td>39.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>107</th>\n",
       "      <td>Mount Barker Surrounds</td>\n",
       "      <td>6851</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.56</td>\n",
       "      <td>41.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>106</th>\n",
       "      <td>Lobethal - Woodside</td>\n",
       "      <td>9410</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.76</td>\n",
       "      <td>34.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>105</th>\n",
       "      <td>Lewiston - Two Wells</td>\n",
       "      <td>6480</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.86</td>\n",
       "      <td>37.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>104</th>\n",
       "      <td>Nairne</td>\n",
       "      <td>5332</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.00</td>\n",
       "      <td>33.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>103</th>\n",
       "      <td>Mount Barker</td>\n",
       "      <td>22080</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.12</td>\n",
       "      <td>31.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>102</th>\n",
       "      <td>Hahndorf - Echunga</td>\n",
       "      <td>4740</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.59</td>\n",
       "      <td>30.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>Gawler - North</td>\n",
       "      <td>9521</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.70</td>\n",
       "      <td>39.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>Gawler - South</td>\n",
       "      <td>21679</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.79</td>\n",
       "      <td>40.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>Willunga</td>\n",
       "      <td>3615</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.82</td>\n",
       "      <td>46.1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   sa2_name  residents  share_half_free  \\\n",
       "108          Adelaide Hills       7032              0.0   \n",
       "107  Mount Barker Surrounds       6851              0.0   \n",
       "106     Lobethal - Woodside       9410              0.0   \n",
       "105    Lewiston - Two Wells       6480              0.0   \n",
       "104                  Nairne       5332              0.0   \n",
       "103            Mount Barker      22080              0.0   \n",
       "102      Hahndorf - Echunga       4740              0.0   \n",
       "100          Gawler - North       9521              0.0   \n",
       "99           Gawler - South      21679              0.0   \n",
       "98                 Willunga       3615              0.0   \n",
       "\n",
       "     places_within_20_free  mean_min_city_free  \n",
       "108                   1.01                39.5  \n",
       "107                   1.56                41.6  \n",
       "106                   1.76                34.3  \n",
       "105                   1.86                37.0  \n",
       "104                   2.00                33.6  \n",
       "103                   2.12                31.5  \n",
       "102                   2.59                30.2  \n",
       "100                   2.70                39.5  \n",
       "99                    2.79                40.1  \n",
       "98                    2.82                46.1  "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "big.sort_values(['share_half_free', 'places_within_20_free'])[['sa2_name', 'residents', 'share_half_free', 'places_within_20_free', 'mean_min_city_free']].head(10)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
