Last active
January 22, 2023 07:05
-
-
Save knaaptime/d487a8c6b48adbc84eccd60f98e06c69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"id": "11457a53-35ba-4ba3-8906-f19486f4c646", | |
"metadata": { | |
"tags": [] | |
}, | |
"source": [ | |
"# W as multiindex adjlist" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"id": "c0b59d7a-0c13-4d78-b21c-9661f3e876cf", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"%load_ext autoreload\n", | |
"%load_ext watermark\n", | |
"%autoreload 2" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"id": "6047b6e8-f13c-4b63-b098-ea224050aeed", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Author: eli knaap\n", | |
"\n", | |
"Last updated: 2023-01-21\n", | |
"\n", | |
"Python implementation: CPython\n", | |
"Python version : 3.10.8\n", | |
"IPython version : 8.8.0\n", | |
"\n", | |
"libpysal: 4.7.0+40.gc795feab541d.dirty\n", | |
"\n" | |
] | |
} | |
], | |
"source": [ | |
"%watermark -a 'eli knaap' -v -d -u -p libpysal" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "18ab6238-24dd-4543-9035-70573a142e4c", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"id": "cbd10da8-c965-455b-ba20-4aef6e9165f5", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from libpysal.weights import Rook, lag_spatial" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"id": "120dd0ce-3f70-4b57-970c-d1ee636d5b17", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import geopandas as gpd\n", | |
"from libpysal import examples" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"id": "4b8f15f8-66c5-4784-bd6b-463a262fafa3", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import libpysal" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"id": "d93dde16-650d-4bbc-8373-c3814699a545", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import pandas as pd" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "6babdc1e-932e-457e-a5dd-6ecd73e0e4a8", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "05a01879-b1ba-4165-aea2-ac42a6948ad5", | |
"metadata": { | |
"tags": [] | |
}, | |
"source": [ | |
"## From scratch" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "ec84c094-fe9b-4a3b-8a91-27da0bdc4d77", | |
"metadata": {}, | |
"source": [ | |
"A `W` takes two dicts, one holding neighbors, and one holding neighbor weights. The lists in each dict have the same sorting, so they can be joined via index" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"id": "07f97427-1eca-40e9-87a4-bf40e9a5d4d3", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"neighbors = {'a':['b'],'b':['a','c'],'c':['b']}\n", | |
"weights = {'a':[0.5],'b':[0.5,1.5],'c':[1.5]}" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"id": "dab9f100-c87a-4b86-a5fb-f1283d2eade8", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"neighbors = {0: [3, 1], 1: [0, 4, 2], 2: [1, 5], 3: [0, 6, 4], 4: [1, 3, 7, 5], 5: [2, 4, 8], 6: [3, 7], 7: [4, 6, 8], 8: [5, 7]}\n", | |
"weights = {0: [1, 1], 1: [1, 1, 1], 2: [1, 1], 3: [1, 1, 1], 4: [1, 1, 1, 1], 5: [1, 1, 1], 6: [1, 1], 7: [1, 1, 1], 8: [1, 1]}" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"id": "f41cf110-8498-4944-904a-45ac853a743b", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"combined = {}\n", | |
"for key in neighbors.keys():\n", | |
" combined[key] = {}\n", | |
" for i, neighbor in enumerate(neighbors[key]):\n", | |
" combined[key][neighbor] = weights[key][i]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"id": "b982031e-9a7d-4cfc-90bf-5155bd51be5f", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"{0: {3: 1, 1: 1},\n", | |
" 1: {0: 1, 4: 1, 2: 1},\n", | |
" 2: {1: 1, 5: 1},\n", | |
" 3: {0: 1, 6: 1, 4: 1},\n", | |
" 4: {1: 1, 3: 1, 7: 1, 5: 1},\n", | |
" 5: {2: 1, 4: 1, 8: 1},\n", | |
" 6: {3: 1, 7: 1},\n", | |
" 7: {4: 1, 6: 1, 8: 1},\n", | |
" 8: {5: 1, 7: 1}}" | |
] | |
}, | |
"execution_count": 10, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"combined" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"id": "464e9a8b-4416-48d2-b5a3-f50e855cacaf", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"combineddf = pd.DataFrame.from_dict(combined).stack()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"id": "ca1959ac-e767-44f8-b3cd-4f753586fb2e", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"combineddf = combineddf.to_frame(name='weights')\n", | |
"combineddf.index.set_names(['focal', 'neighbor'], inplace=True)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"id": "4f4b1ed2-2c00-4a0f-8586-6aec143f1b5b", | |
"metadata": {}, | |
"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></th>\n", | |
" <th>weights</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>focal</th>\n", | |
" <th>neighbor</th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th rowspan=\"3\" valign=\"top\">3</th>\n", | |
" <th>0</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>6</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"3\" valign=\"top\">1</th>\n", | |
" <th>0</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"2\" valign=\"top\">0</th>\n", | |
" <th>1</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"4\" valign=\"top\">4</th>\n", | |
" <th>1</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>5</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>7</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"2\" valign=\"top\">2</th>\n", | |
" <th>1</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>5</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"3\" valign=\"top\">5</th>\n", | |
" <th>2</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>8</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"2\" valign=\"top\">6</th>\n", | |
" <th>3</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>7</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"3\" valign=\"top\">7</th>\n", | |
" <th>4</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>6</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>8</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"2\" valign=\"top\">8</th>\n", | |
" <th>5</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>7</th>\n", | |
" <td>1.0</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" weights\n", | |
"focal neighbor \n", | |
"3 0 1.0\n", | |
" 4 1.0\n", | |
" 6 1.0\n", | |
"1 0 1.0\n", | |
" 2 1.0\n", | |
" 4 1.0\n", | |
"0 1 1.0\n", | |
" 3 1.0\n", | |
"4 1 1.0\n", | |
" 3 1.0\n", | |
" 5 1.0\n", | |
" 7 1.0\n", | |
"2 1 1.0\n", | |
" 5 1.0\n", | |
"5 2 1.0\n", | |
" 4 1.0\n", | |
" 8 1.0\n", | |
"6 3 1.0\n", | |
" 7 1.0\n", | |
"7 4 1.0\n", | |
" 6 1.0\n", | |
" 8 1.0\n", | |
"8 5 1.0\n", | |
" 7 1.0" | |
] | |
}, | |
"execution_count": 13, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"combineddf" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "82e904f8-ab9a-4b72-9d48-c8182ae5635b", | |
"metadata": {}, | |
"source": [ | |
"arbitrarily rename indices" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 14, | |
"id": "6bfaa723-88a0-4af2-963f-5f8ae5537b67", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"combineddf = combineddf.reset_index()\n", | |
"combineddf[['focal', 'neighbor']] = combineddf[['focal', 'neighbor']].replace(dict(zip(list(range(0,10)), 'abcdefghi')))\n", | |
"combineddf = combineddf.set_index(['focal', 'neighbor'])" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "2b380a6d-b54b-4604-8efc-9a53f5b51a47", | |
"metadata": {}, | |
"source": [ | |
"Transformations" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 15, | |
"id": "ed6e7fb5-6dc8-4088-9169-41b3e7655c0f", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# original is the same as instantiation, so store it\n", | |
"combineddf['weights_o'] = combineddf['weights']" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 16, | |
"id": "8086c6a2-d087-49fa-8902-821c4486539d", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# binary is always 1 (can be created on the fly and saved as column when necessary)\n", | |
"combineddf['weights_b'] = 1" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 17, | |
"id": "e2385e55-e94f-483c-bf40-9d51db0ca950", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# row-standardized is weight over group total weights (can be created on the fly and saved as column when necessary)\n", | |
"combineddf['weights_r'] = combineddf['weights'] / combineddf.groupby('focal')['weights'].transform('sum')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 18, | |
"id": "7102b5a4-7905-41c5-9434-35ac313c7826", | |
"metadata": {}, | |
"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></th>\n", | |
" <th>weights</th>\n", | |
" <th>weights_o</th>\n", | |
" <th>weights_b</th>\n", | |
" <th>weights_r</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>focal</th>\n", | |
" <th>neighbor</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th rowspan=\"3\" valign=\"top\">d</th>\n", | |
" <th>a</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.333333</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>e</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.333333</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>g</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.333333</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"3\" valign=\"top\">b</th>\n", | |
" <th>a</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.333333</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>c</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.333333</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>e</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.333333</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"2\" valign=\"top\">a</th>\n", | |
" <th>b</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.500000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>d</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.500000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"4\" valign=\"top\">e</th>\n", | |
" <th>b</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.250000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>d</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.250000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>f</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.250000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>h</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.250000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"2\" valign=\"top\">c</th>\n", | |
" <th>b</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.500000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>f</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.500000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"3\" valign=\"top\">f</th>\n", | |
" <th>c</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.333333</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>e</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.333333</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>i</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.333333</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"2\" valign=\"top\">g</th>\n", | |
" <th>d</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.500000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>h</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.500000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"3\" valign=\"top\">h</th>\n", | |
" <th>e</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.333333</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>g</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.333333</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>i</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.333333</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"2\" valign=\"top\">i</th>\n", | |
" <th>f</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.500000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>h</th>\n", | |
" <td>1.0</td>\n", | |
" <td>1.0</td>\n", | |
" <td>1</td>\n", | |
" <td>0.500000</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" weights weights_o weights_b weights_r\n", | |
"focal neighbor \n", | |
"d a 1.0 1.0 1 0.333333\n", | |
" e 1.0 1.0 1 0.333333\n", | |
" g 1.0 1.0 1 0.333333\n", | |
"b a 1.0 1.0 1 0.333333\n", | |
" c 1.0 1.0 1 0.333333\n", | |
" e 1.0 1.0 1 0.333333\n", | |
"a b 1.0 1.0 1 0.500000\n", | |
" d 1.0 1.0 1 0.500000\n", | |
"e b 1.0 1.0 1 0.250000\n", | |
" d 1.0 1.0 1 0.250000\n", | |
" f 1.0 1.0 1 0.250000\n", | |
" h 1.0 1.0 1 0.250000\n", | |
"c b 1.0 1.0 1 0.500000\n", | |
" f 1.0 1.0 1 0.500000\n", | |
"f c 1.0 1.0 1 0.333333\n", | |
" e 1.0 1.0 1 0.333333\n", | |
" i 1.0 1.0 1 0.333333\n", | |
"g d 1.0 1.0 1 0.500000\n", | |
" h 1.0 1.0 1 0.500000\n", | |
"h e 1.0 1.0 1 0.333333\n", | |
" g 1.0 1.0 1 0.333333\n", | |
" i 1.0 1.0 1 0.333333\n", | |
"i f 1.0 1.0 1 0.500000\n", | |
" h 1.0 1.0 1 0.500000" | |
] | |
}, | |
"execution_count": 18, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"combineddf" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "5169620f-a132-490c-b6ee-5be2cdb9a716", | |
"metadata": {}, | |
"source": [ | |
"So, without changing the signature of the `W`, which takes two dicts, we can store it as a multiindex dataframe internally. There are a bunch of handy things about that, but most important is that we dont need to worry about indexing and alignment between the two dicts (and their internal lists) anymore" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "1bc81a05-024f-4754-997e-9d3e560a6fc9", | |
"metadata": {}, | |
"source": [ | |
"## Example" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "2883c343-7fe7-43d4-8351-7c2e87374c6c", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "2f45d3e6-0f0a-4e1d-ae6b-02a3d6b6781f", | |
"metadata": {}, | |
"source": [ | |
"Here I'll just cheat by creating a W then going to an adjlist, but its useful to have a bigger example" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 19, | |
"id": "3acce581-8453-4615-9724-5a0527184fde", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"us = gpd.read_file(examples.get_path(\"us48.shp\"))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 20, | |
"id": "a359e945-2bce-45cb-a41f-793a1fc247a7", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"us = us.set_index('STATE_FIPS')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "2fcf5dac-6d19-4438-a9f6-41bbd15a94c0", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 21, | |
"id": "c6ff1f09-7c67-4bf8-8358-2046f055a5b8", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"/Users/knaaptime/Dropbox/projects/libpysal/libpysal/weights/contiguity.py:57: FutureWarning: `id_order` is deprecated and will be removed in future.\n", | |
" W.__init__(self, neighbors, ids=ids, **kw)\n" | |
] | |
} | |
], | |
"source": [ | |
"w_us_rook = Rook.from_dataframe(us, use_index=True, perimeter=True, perim_std=True)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 22, | |
"id": "2e8d8672-8972-44ce-a160-47d771d5e82d", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"{'01': ['47', '28', '13', '12'],\n", | |
" '04': ['32', '49', '06', '35'],\n", | |
" '05': ['29', '40', '47', '48', '28', '22'],\n", | |
" '06': ['41', '32', '04'],\n", | |
" '08': ['56', '31', '49', '20', '40', '35'],\n", | |
" '09': ['25', '36', '44'],\n", | |
" '10': ['42', '34', '24'],\n", | |
" '12': ['01', '13'],\n", | |
" '13': ['37', '47', '01', '45', '12'],\n", | |
" '16': ['53', '30', '56', '41', '32', '49'],\n", | |
" '17': ['55', '19', '18', '21', '29'],\n", | |
" '18': ['39', '17', '21', '26'],\n", | |
" '19': ['46', '55', '27', '31', '17', '29'],\n", | |
" '20': ['31', '08', '29', '40'],\n", | |
" '21': ['18', '39', '17', '54', '51', '29', '47'],\n", | |
" '22': ['48', '28', '05'],\n", | |
" '23': ['33'],\n", | |
" '24': ['42', '10', '54', '51'],\n", | |
" '25': ['50', '33', '36', '09', '44'],\n", | |
" '26': ['55', '18', '39'],\n", | |
" '27': ['38', '46', '55', '19'],\n", | |
" '28': ['47', '01', '05', '22'],\n", | |
" '29': ['19', '31', '17', '21', '20', '40', '47', '05'],\n", | |
" '30': ['38', '46', '56', '16'],\n", | |
" '31': ['46', '56', '19', '08', '20', '29'],\n", | |
" '32': ['16', '41', '49', '06', '04'],\n", | |
" '33': ['23', '50', '25'],\n", | |
" '34': ['36', '42', '10'],\n", | |
" '35': ['08', '04', '40', '48'],\n", | |
" '36': ['50', '25', '42', '09', '34'],\n", | |
" '37': ['51', '47', '13', '45'],\n", | |
" '38': ['30', '46', '27'],\n", | |
" '39': ['42', '18', '54', '21', '26'],\n", | |
" '40': ['08', '20', '29', '48', '35', '05'],\n", | |
" '41': ['53', '16', '32', '06'],\n", | |
" '42': ['36', '34', '39', '10', '54', '24'],\n", | |
" '44': ['25', '09'],\n", | |
" '45': ['37', '13'],\n", | |
" '46': ['30', '38', '56', '27', '19', '31'],\n", | |
" '47': ['21', '51', '29', '37', '01', '28', '13', '05'],\n", | |
" '48': ['40', '35', '05', '22'],\n", | |
" '49': ['56', '16', '32', '08', '04'],\n", | |
" '50': ['33', '25', '36'],\n", | |
" '51': ['54', '24', '21', '37', '47'],\n", | |
" '53': ['16', '41'],\n", | |
" '54': ['42', '39', '24', '21', '51'],\n", | |
" '55': ['27', '19', '17', '26'],\n", | |
" '56': ['30', '46', '16', '31', '49', '08']}" | |
] | |
}, | |
"execution_count": 22, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"w_us_rook.neighbors" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 23, | |
"id": "55ed121d-1dfd-4c5e-8743-2b0dc5d9ddfd", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"adj = w_us_rook.to_adjlist()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 24, | |
"id": "c74c1c4b-1e99-4201-a4f1-c8eb2cf43a02", | |
"metadata": {}, | |
"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>focal</th>\n", | |
" <th>neighbor</th>\n", | |
" <th>weight</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>0</th>\n", | |
" <td>01</td>\n", | |
" <td>12</td>\n", | |
" <td>0.189223</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>1</th>\n", | |
" <td>01</td>\n", | |
" <td>13</td>\n", | |
" <td>0.258420</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>01</td>\n", | |
" <td>28</td>\n", | |
" <td>0.271672</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>01</td>\n", | |
" <td>47</td>\n", | |
" <td>0.150561</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>04</td>\n", | |
" <td>06</td>\n", | |
" <td>0.147443</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>...</th>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>205</th>\n", | |
" <td>56</td>\n", | |
" <td>16</td>\n", | |
" <td>0.112667</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>206</th>\n", | |
" <td>56</td>\n", | |
" <td>30</td>\n", | |
" <td>0.341860</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>207</th>\n", | |
" <td>56</td>\n", | |
" <td>31</td>\n", | |
" <td>0.090960</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>208</th>\n", | |
" <td>56</td>\n", | |
" <td>46</td>\n", | |
" <td>0.090707</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>209</th>\n", | |
" <td>56</td>\n", | |
" <td>49</td>\n", | |
" <td>0.136551</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"<p>210 rows × 3 columns</p>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" focal neighbor weight\n", | |
"0 01 12 0.189223\n", | |
"1 01 13 0.258420\n", | |
"2 01 28 0.271672\n", | |
"3 01 47 0.150561\n", | |
"4 04 06 0.147443\n", | |
".. ... ... ...\n", | |
"205 56 16 0.112667\n", | |
"206 56 30 0.341860\n", | |
"207 56 31 0.090960\n", | |
"208 56 46 0.090707\n", | |
"209 56 49 0.136551\n", | |
"\n", | |
"[210 rows x 3 columns]" | |
] | |
}, | |
"execution_count": 24, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"adj" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 25, | |
"id": "451c5aff-c947-49a6-b642-e4ab13ba5965", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# rook weights as a multiindex adjlist\n", | |
"w_midx = w_us_rook.to_adjlist().set_index(['focal','neighbor'])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 26, | |
"id": "7d3ddd0f-6491-49f0-8ad7-4ffc871a9a16", | |
"metadata": {}, | |
"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></th>\n", | |
" <th>weight</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>focal</th>\n", | |
" <th>neighbor</th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th rowspan=\"4\" valign=\"top\">01</th>\n", | |
" <th>12</th>\n", | |
" <td>0.189223</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>13</th>\n", | |
" <td>0.258420</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>28</th>\n", | |
" <td>0.271672</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>47</th>\n", | |
" <td>0.150561</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>04</th>\n", | |
" <th>06</th>\n", | |
" <td>0.147443</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>...</th>\n", | |
" <th>...</th>\n", | |
" <td>...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th rowspan=\"5\" valign=\"top\">56</th>\n", | |
" <th>16</th>\n", | |
" <td>0.112667</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>30</th>\n", | |
" <td>0.341860</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>31</th>\n", | |
" <td>0.090960</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>46</th>\n", | |
" <td>0.090707</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>49</th>\n", | |
" <td>0.136551</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"<p>210 rows × 1 columns</p>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" weight\n", | |
"focal neighbor \n", | |
"01 12 0.189223\n", | |
" 13 0.258420\n", | |
" 28 0.271672\n", | |
" 47 0.150561\n", | |
"04 06 0.147443\n", | |
"... ...\n", | |
"56 16 0.112667\n", | |
" 30 0.341860\n", | |
" 31 0.090960\n", | |
" 46 0.090707\n", | |
" 49 0.136551\n", | |
"\n", | |
"[210 rows x 1 columns]" | |
] | |
}, | |
"execution_count": 26, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"w_midx" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "c0b46eaa-ef9c-40a7-ac97-2c4fc3f1a5a9", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "f48c8909-c0ed-4c60-996b-d400441add92", | |
"metadata": {}, | |
"source": [ | |
"### getters" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 27, | |
"id": "1238d03e-2e4c-4176-859f-8ca2fb239a2c", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"{'41': 0.09969336385228574,\n", | |
" '32': 0.22937096770923632,\n", | |
" '04': 0.08114331654577743}" | |
] | |
}, | |
"execution_count": 27, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"# keying the class gives back neighbor:weight dict\n", | |
"w_us_rook['06']" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 28, | |
"id": "a406f0c7-5bbb-4488-8938-1f86cff9e5d7", | |
"metadata": {}, | |
"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>weight</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>neighbor</th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>04</th>\n", | |
" <td>0.081143</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>32</th>\n", | |
" <td>0.229371</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>41</th>\n", | |
" <td>0.099693</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" weight\n", | |
"neighbor \n", | |
"04 0.081143\n", | |
"32 0.229371\n", | |
"41 0.099693" | |
] | |
}, | |
"execution_count": 28, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"# keying the midx gives back a dataframe\n", | |
"w_midx.loc['06']" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 29, | |
"id": "a96026e6-864d-46de-a262-bd9f55f0ed73", | |
"metadata": {}, | |
"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>neighbor</th>\n", | |
" <th>04</th>\n", | |
" <th>32</th>\n", | |
" <th>41</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>weight</th>\n", | |
" <td>0.081143</td>\n", | |
" <td>0.229371</td>\n", | |
" <td>0.099693</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
"neighbor 04 32 41\n", | |
"weight 0.081143 0.229371 0.099693" | |
] | |
}, | |
"execution_count": 29, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"# if we treat the multiindex as a col\n", | |
"w_midx.T['06']" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 30, | |
"id": "ba3d162c-3568-41fd-a054-639e81573d68", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"{'04': 0.08114331654577743,\n", | |
" '32': 0.22937096770923632,\n", | |
" '41': 0.09969336385228574}" | |
] | |
}, | |
"execution_count": 30, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"# get the same dict as the old class if we want\n", | |
"w_midx.loc['06'].to_dict()['weight']" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "f5cb6a0e-2504-4956-8c06-362ee98953dd", | |
"metadata": { | |
"tags": [] | |
}, | |
"source": [ | |
"### neighbors" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 31, | |
"id": "6ac7448b-459b-4c9c-b597-28a2caa53da2", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"{'01': ['47', '28', '13', '12'],\n", | |
" '04': ['32', '49', '06', '35'],\n", | |
" '05': ['29', '40', '47', '48', '28', '22'],\n", | |
" '06': ['41', '32', '04'],\n", | |
" '08': ['56', '31', '49', '20', '40', '35'],\n", | |
" '09': ['25', '36', '44'],\n", | |
" '10': ['42', '34', '24'],\n", | |
" '12': ['01', '13'],\n", | |
" '13': ['37', '47', '01', '45', '12'],\n", | |
" '16': ['53', '30', '56', '41', '32', '49'],\n", | |
" '17': ['55', '19', '18', '21', '29'],\n", | |
" '18': ['39', '17', '21', '26'],\n", | |
" '19': ['46', '55', '27', '31', '17', '29'],\n", | |
" '20': ['31', '08', '29', '40'],\n", | |
" '21': ['18', '39', '17', '54', '51', '29', '47'],\n", | |
" '22': ['48', '28', '05'],\n", | |
" '23': ['33'],\n", | |
" '24': ['42', '10', '54', '51'],\n", | |
" '25': ['50', '33', '36', '09', '44'],\n", | |
" '26': ['55', '18', '39'],\n", | |
" '27': ['38', '46', '55', '19'],\n", | |
" '28': ['47', '01', '05', '22'],\n", | |
" '29': ['19', '31', '17', '21', '20', '40', '47', '05'],\n", | |
" '30': ['38', '46', '56', '16'],\n", | |
" '31': ['46', '56', '19', '08', '20', '29'],\n", | |
" '32': ['16', '41', '49', '06', '04'],\n", | |
" '33': ['23', '50', '25'],\n", | |
" '34': ['36', '42', '10'],\n", | |
" '35': ['08', '04', '40', '48'],\n", | |
" '36': ['50', '25', '42', '09', '34'],\n", | |
" '37': ['51', '47', '13', '45'],\n", | |
" '38': ['30', '46', '27'],\n", | |
" '39': ['42', '18', '54', '21', '26'],\n", | |
" '40': ['08', '20', '29', '48', '35', '05'],\n", | |
" '41': ['53', '16', '32', '06'],\n", | |
" '42': ['36', '34', '39', '10', '54', '24'],\n", | |
" '44': ['25', '09'],\n", | |
" '45': ['37', '13'],\n", | |
" '46': ['30', '38', '56', '27', '19', '31'],\n", | |
" '47': ['21', '51', '29', '37', '01', '28', '13', '05'],\n", | |
" '48': ['40', '35', '05', '22'],\n", | |
" '49': ['56', '16', '32', '08', '04'],\n", | |
" '50': ['33', '25', '36'],\n", | |
" '51': ['54', '24', '21', '37', '47'],\n", | |
" '53': ['16', '41'],\n", | |
" '54': ['42', '39', '24', '21', '51'],\n", | |
" '55': ['27', '19', '17', '26'],\n", | |
" '56': ['30', '46', '16', '31', '49', '08']}" | |
] | |
}, | |
"execution_count": 31, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"w_us_rook.neighbors" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 32, | |
"id": "9c178012-f277-40f8-ac03-fdf2fe4fe81a", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"{'01': ['12', '13', '28', '47'],\n", | |
" '04': ['06', '32', '35', '49'],\n", | |
" '05': ['22', '28', '29', '40', '47', '48'],\n", | |
" '06': ['04', '32', '41'],\n", | |
" '08': ['20', '31', '35', '40', '49', '56'],\n", | |
" '09': ['25', '36', '44'],\n", | |
" '10': ['24', '34', '42'],\n", | |
" '12': ['01', '13'],\n", | |
" '13': ['01', '12', '37', '45', '47'],\n", | |
" '16': ['30', '32', '41', '49', '53', '56'],\n", | |
" '17': ['18', '19', '21', '29', '55'],\n", | |
" '18': ['17', '21', '26', '39'],\n", | |
" '19': ['17', '27', '29', '31', '46', '55'],\n", | |
" '20': ['08', '29', '31', '40'],\n", | |
" '21': ['17', '18', '29', '39', '47', '51', '54'],\n", | |
" '22': ['05', '28', '48'],\n", | |
" '23': ['33'],\n", | |
" '24': ['10', '42', '51', '54'],\n", | |
" '25': ['09', '33', '36', '44', '50'],\n", | |
" '26': ['18', '39', '55'],\n", | |
" '27': ['19', '38', '46', '55'],\n", | |
" '28': ['01', '05', '22', '47'],\n", | |
" '29': ['05', '17', '19', '20', '21', '31', '40', '47'],\n", | |
" '30': ['16', '38', '46', '56'],\n", | |
" '31': ['08', '19', '20', '29', '46', '56'],\n", | |
" '32': ['04', '06', '16', '41', '49'],\n", | |
" '33': ['23', '25', '50'],\n", | |
" '34': ['10', '36', '42'],\n", | |
" '35': ['04', '08', '40', '48'],\n", | |
" '36': ['09', '25', '34', '42', '50'],\n", | |
" '37': ['13', '45', '47', '51'],\n", | |
" '38': ['27', '30', '46'],\n", | |
" '39': ['18', '21', '26', '42', '54'],\n", | |
" '40': ['05', '08', '20', '29', '35', '48'],\n", | |
" '41': ['06', '16', '32', '53'],\n", | |
" '42': ['10', '24', '34', '36', '39', '54'],\n", | |
" '44': ['09', '25'],\n", | |
" '45': ['13', '37'],\n", | |
" '46': ['19', '27', '30', '31', '38', '56'],\n", | |
" '47': ['01', '05', '13', '21', '28', '29', '37', '51'],\n", | |
" '48': ['05', '22', '35', '40'],\n", | |
" '49': ['04', '08', '16', '32', '56'],\n", | |
" '50': ['25', '33', '36'],\n", | |
" '51': ['21', '24', '37', '47', '54'],\n", | |
" '53': ['16', '41'],\n", | |
" '54': ['21', '24', '39', '42', '51'],\n", | |
" '55': ['17', '19', '26', '27'],\n", | |
" '56': ['08', '16', '30', '31', '46', '49']}" | |
] | |
}, | |
"execution_count": 32, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"# neighbors dict\n", | |
"w_midx.reset_index().groupby('focal').agg(lambda x: list(x.unique()))['neighbor'].to_dict()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 33, | |
"id": "839b7c4b-698a-4a21-b09a-a3c4cd234d3b", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"['41', '32', '04']" | |
] | |
}, | |
"execution_count": 33, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"# keying neighbors on the class gives list of neighbor indices\n", | |
"w_us_rook.neighbors['06']" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 34, | |
"id": "e0bcbaa1-1df9-468d-a034-d619159475a9", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"['04', '32', '41']" | |
] | |
}, | |
"execution_count": 34, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"w_midx.loc['06'].index.tolist()" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "15d98b2c-f404-4ac8-8452-c045dbd10140", | |
"metadata": {}, | |
"source": [ | |
"### weights" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 35, | |
"id": "b8b76974-d0a5-449b-803a-a6dc966685e7", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"{'01': [0.15056051563849604,\n", | |
" 0.27167249589092923,\n", | |
" 0.2584195946024519,\n", | |
" 0.18922315538653062],\n", | |
" '04': [0.1273670966901304,\n", | |
" 0.21488597860621342,\n", | |
" 0.14744300529539717,\n", | |
" 0.24307953056855658],\n", | |
" '05': [0.2814283495819333,\n", | |
" 0.13779082185808825,\n", | |
" 0.11764277931181141,\n", | |
" 0.06199058456755633,\n", | |
" 0.26335479323704575,\n", | |
" 0.13779267144356552],\n", | |
" '06': [0.09969336385228574, 0.22937096770923632, 0.08114331654577743],\n", | |
" '08': [0.22685453423528587,\n", | |
" 0.13635258288214672,\n", | |
" 0.18173430246425612,\n", | |
" 0.13666451538321478,\n", | |
" 0.04360954095197256,\n", | |
" 0.27478452408312387],\n", | |
" '09': [0.3085675083411396, 0.22100014534531814, 0.1285515376567396],\n", | |
" '10': [0.10503036591252485, 0.031959534943084664, 0.464442553323712],\n", | |
" '12': [0.07939083354786433, 0.10707934074028068],\n", | |
" '13': [0.06057389305520654,\n", | |
" 0.06393208269167952,\n", | |
" 0.2215823933393675,\n", | |
" 0.2325732015528852,\n", | |
" 0.21883632620587262],\n", | |
" '16': [0.10933213977575466,\n", | |
" 0.3852713286259378,\n", | |
" 0.08682940844864023,\n", | |
" 0.175356039864057,\n", | |
" 0.10444383847875532,\n", | |
" 0.1048202816713714],\n", | |
" '17': [0.14206656178609095,\n", | |
" 0.17560669832236328,\n", | |
" 0.25522825223190826,\n", | |
" 0.10439153512213484,\n", | |
" 0.27991862232754994],\n", | |
" '18': [0.16108760416404916,\n", | |
" 0.3168389685990262,\n", | |
" 0.3417470709007413,\n", | |
" 0.1309609233975768],\n", | |
" '19': [0.08066982680124303,\n", | |
" 0.07744334084165977,\n", | |
" 0.27869792388543824,\n", | |
" 0.13863355755979384,\n", | |
" 0.18690579484333658,\n", | |
" 0.23764955606852786],\n", | |
" '20': [0.31954381593410314,\n", | |
" 0.14262697772302974,\n", | |
" 0.18639556590945214,\n", | |
" 0.3514336404334146],\n", | |
" '21': [0.26028745004088205,\n", | |
" 0.1349580593800648,\n", | |
" 0.09870145533861117,\n", | |
" 0.0699206739713788,\n", | |
" 0.09938656968702196,\n", | |
" 0.05135309701555802,\n", | |
" 0.28539269456648314],\n", | |
" '22': [0.12746173718915565, 0.25128216084944416, 0.08832312565687005],\n", | |
" '23': [0.12140730987872161],\n", | |
" '24': [0.1686349222753439,\n", | |
" 0.0865028706320544,\n", | |
" 0.16190626903845767,\n", | |
" 0.06451570238701951],\n", | |
" '25': [0.06123829313969083,\n", | |
" 0.13430520865999182,\n", | |
" 0.05678232921530946,\n", | |
" 0.1347375578343168,\n", | |
" 0.08219230121295769],\n", | |
" '26': [0.10197112154059323, 0.05168191053370197, 0.03204048493574089],\n", | |
" '27': [0.1348808920265257,\n", | |
" 0.09486657557466659,\n", | |
" 0.16145404625842444,\n", | |
" 0.17745379927345614],\n", | |
" '28': [0.09571526070110069,\n", | |
" 0.2122857803172968,\n", | |
" 0.2492321014057132,\n", | |
" 0.37100187140389507],\n", | |
" '29': [0.18924841066860845,\n", | |
" 0.04400883711857978,\n", | |
" 0.23725136212267225,\n", | |
" 0.046034697166520124,\n", | |
" 0.1667167477564779,\n", | |
" 0.02151629008108407,\n", | |
" 0.046221485198072905,\n", | |
" 0.2490021698879845],\n", | |
" '30': [0.088545602265214,\n", | |
" 0.027861708894275836,\n", | |
" 0.21769436753247792,\n", | |
" 0.31834365845096485],\n", | |
" '31': [0.3418146897176279,\n", | |
" 0.08552839789777344,\n", | |
" 0.11140315909188832,\n", | |
" 0.12843602041815516,\n", | |
" 0.2884084461566712,\n", | |
" 0.04440928671788418],\n", | |
" '32': [0.12621247507513025,\n", | |
" 0.12599376975760573,\n", | |
" 0.21174370207770773,\n", | |
" 0.4105788734184803,\n", | |
" 0.12547117967107618],\n", | |
" '33': [0.27397659199153557, 0.36894566931104195, 0.21016760433800208],\n", | |
" '34': [0.14238173234116833, 0.33325480281397724, 0.015469502990786236],\n", | |
" '35': [0.25712925130986486,\n", | |
" 0.2401824850200944,\n", | |
" 0.021504362137012692,\n", | |
" 0.35620249751310457],\n", | |
" '36': [0.09542799996267419,\n", | |
" 0.02612186789921588,\n", | |
" 0.20357317855564624,\n", | |
" 0.044393773563768356,\n", | |
" 0.042081642327690114],\n", | |
" '37': [0.16417453365744444,\n", | |
" 0.1105936864521856,\n", | |
" 0.03521244389163445,\n", | |
" 0.15348757517422806],\n", | |
" '38': [0.14317510157808844, 0.3503936188970017, 0.18640951977298856],\n", | |
" '39': [0.08375170089817162,\n", | |
" 0.16088715088803351,\n", | |
" 0.2657130876700894,\n", | |
" 0.17697406864583434,\n", | |
" 0.08108891469643228],\n", | |
" '40': [0.03758326797288424,\n", | |
" 0.2902087100441498,\n", | |
" 0.01986510429366597,\n", | |
" 0.5199789737482601,\n", | |
" 0.019805252089629306,\n", | |
" 0.11255869185141058],\n", | |
" '41': [0.28176182705362535,\n", | |
" 0.20183197316736273,\n", | |
" 0.12000486375592635,\n", | |
" 0.16997074578365404],\n", | |
" '42': [0.3443539159607031,\n", | |
" 0.1666093206886059,\n", | |
" 0.08021816759844957,\n", | |
" 0.02541637822916804,\n", | |
" 0.11634472037496674,\n", | |
" 0.21910272908918724],\n", | |
" '44': [0.29570050993204255, 0.20194666569397182],\n", | |
" '45': [0.3291387977407384, 0.2899186850351894],\n", | |
" '46': [0.04229191390190933,\n", | |
" 0.32893135492113046,\n", | |
" 0.08767740176369734,\n", | |
" 0.12307786884547084,\n", | |
" 0.06663914811214806,\n", | |
" 0.3513823124556439],\n", | |
" '47': [0.2812981670286354,\n", | |
" 0.0959886637197837,\n", | |
" 0.05082171264210024,\n", | |
" 0.1782226975885081,\n", | |
" 0.12093841184342884,\n", | |
" 0.09839184911156434,\n", | |
" 0.05989108930559947,\n", | |
" 0.11444740876038052],\n", | |
" '48': [0.20505448218283542,\n", | |
" 0.12937020133795535,\n", | |
" 0.01996953547482233,\n", | |
" 0.06405805592232551],\n", | |
" '49': [0.15017424732977155,\n", | |
" 0.1495809103371144,\n", | |
" 0.25004714053805893,\n", | |
" 0.20021716228005287,\n", | |
" 0.2499805395150025],\n", | |
" '50': [0.36564775752557827, 0.09497219872578576, 0.32170529674621084],\n", | |
" '51': [0.2220950071785863,\n", | |
" 0.04524654286767907,\n", | |
" 0.06738097877533665,\n", | |
" 0.18198015605307716,\n", | |
" 0.06602455905684683],\n", | |
" '53': [0.08923076093292966, 0.19979272321365937],\n", | |
" '54': [0.10767874231249458,\n", | |
" 0.23554578751261734,\n", | |
" 0.19469160684842685,\n", | |
" 0.08127908619385915,\n", | |
" 0.3808047771326015],\n", | |
" '55': [0.2176464612575561,\n", | |
" 0.0664719355819708,\n", | |
" 0.12978598701348362,\n", | |
" 0.19015443302675836],\n", | |
" '56': [0.3418603030298269,\n", | |
" 0.09070674090697921,\n", | |
" 0.11266728662737108,\n", | |
" 0.09096019910204023,\n", | |
" 0.1365512271564498,\n", | |
" 0.22725424317733278]}" | |
] | |
}, | |
"execution_count": 35, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"w_us_rook.weights" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 36, | |
"id": "4184d0fc-ac73-4131-b040-20a2b1c3458f", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"{'01': [0.18922315538653062,\n", | |
" 0.2584195946024519,\n", | |
" 0.27167249589092923,\n", | |
" 0.15056051563849604],\n", | |
" '04': [0.14744300529539717,\n", | |
" 0.1273670966901304,\n", | |
" 0.24307953056855658,\n", | |
" 0.21488597860621342],\n", | |
" '05': [0.13779267144356552,\n", | |
" 0.26335479323704575,\n", | |
" 0.2814283495819333,\n", | |
" 0.13779082185808825,\n", | |
" 0.11764277931181141,\n", | |
" 0.06199058456755633],\n", | |
" '06': [0.08114331654577743, 0.22937096770923632, 0.09969336385228574],\n", | |
" '08': [0.13666451538321478,\n", | |
" 0.13635258288214672,\n", | |
" 0.27478452408312387,\n", | |
" 0.04360954095197256,\n", | |
" 0.18173430246425612,\n", | |
" 0.22685453423528587],\n", | |
" '09': [0.3085675083411396, 0.22100014534531814, 0.1285515376567396],\n", | |
" '10': [0.464442553323712, 0.031959534943084664, 0.10503036591252485],\n", | |
" '12': [0.07939083354786433, 0.10707934074028068],\n", | |
" '13': [0.2215823933393675,\n", | |
" 0.21883632620587262,\n", | |
" 0.06057389305520654,\n", | |
" 0.2325732015528852,\n", | |
" 0.06393208269167952],\n", | |
" '16': [0.3852713286259378,\n", | |
" 0.10444383847875532,\n", | |
" 0.175356039864057,\n", | |
" 0.1048202816713714,\n", | |
" 0.10933213977575466,\n", | |
" 0.08682940844864023],\n", | |
" '17': [0.25522825223190826,\n", | |
" 0.17560669832236328,\n", | |
" 0.10439153512213484,\n", | |
" 0.27991862232754994,\n", | |
" 0.14206656178609095],\n", | |
" '18': [0.3168389685990262,\n", | |
" 0.3417470709007413,\n", | |
" 0.1309609233975768,\n", | |
" 0.16108760416404916],\n", | |
" '19': [0.18690579484333658,\n", | |
" 0.27869792388543824,\n", | |
" 0.23764955606852786,\n", | |
" 0.13863355755979384,\n", | |
" 0.08066982680124303,\n", | |
" 0.07744334084165977],\n", | |
" '20': [0.14262697772302974,\n", | |
" 0.18639556590945214,\n", | |
" 0.31954381593410314,\n", | |
" 0.3514336404334146],\n", | |
" '21': [0.09870145533861117,\n", | |
" 0.26028745004088205,\n", | |
" 0.05135309701555802,\n", | |
" 0.1349580593800648,\n", | |
" 0.28539269456648314,\n", | |
" 0.09938656968702196,\n", | |
" 0.0699206739713788],\n", | |
" '22': [0.08832312565687005, 0.25128216084944416, 0.12746173718915565],\n", | |
" '23': [0.12140730987872161],\n", | |
" '24': [0.0865028706320544,\n", | |
" 0.1686349222753439,\n", | |
" 0.06451570238701951,\n", | |
" 0.16190626903845767],\n", | |
" '25': [0.1347375578343168,\n", | |
" 0.13430520865999182,\n", | |
" 0.05678232921530946,\n", | |
" 0.08219230121295769,\n", | |
" 0.06123829313969083],\n", | |
" '26': [0.05168191053370197, 0.03204048493574089, 0.10197112154059323],\n", | |
" '27': [0.17745379927345614,\n", | |
" 0.1348808920265257,\n", | |
" 0.09486657557466659,\n", | |
" 0.16145404625842444],\n", | |
" '28': [0.2122857803172968,\n", | |
" 0.2492321014057132,\n", | |
" 0.37100187140389507,\n", | |
" 0.09571526070110069],\n", | |
" '29': [0.2490021698879845,\n", | |
" 0.23725136212267225,\n", | |
" 0.18924841066860845,\n", | |
" 0.1667167477564779,\n", | |
" 0.046034697166520124,\n", | |
" 0.04400883711857978,\n", | |
" 0.02151629008108407,\n", | |
" 0.046221485198072905],\n", | |
" '30': [0.31834365845096485,\n", | |
" 0.088545602265214,\n", | |
" 0.027861708894275836,\n", | |
" 0.21769436753247792],\n", | |
" '31': [0.12843602041815516,\n", | |
" 0.11140315909188832,\n", | |
" 0.2884084461566712,\n", | |
" 0.04440928671788418,\n", | |
" 0.3418146897176279,\n", | |
" 0.08552839789777344],\n", | |
" '32': [0.12547117967107618,\n", | |
" 0.4105788734184803,\n", | |
" 0.12621247507513025,\n", | |
" 0.12599376975760573,\n", | |
" 0.21174370207770773],\n", | |
" '33': [0.27397659199153557, 0.21016760433800208, 0.36894566931104195],\n", | |
" '34': [0.015469502990786236, 0.14238173234116833, 0.33325480281397724],\n", | |
" '35': [0.2401824850200944,\n", | |
" 0.25712925130986486,\n", | |
" 0.021504362137012692,\n", | |
" 0.35620249751310457],\n", | |
" '36': [0.044393773563768356,\n", | |
" 0.02612186789921588,\n", | |
" 0.042081642327690114,\n", | |
" 0.20357317855564624,\n", | |
" 0.09542799996267419],\n", | |
" '37': [0.03521244389163445,\n", | |
" 0.15348757517422806,\n", | |
" 0.1105936864521856,\n", | |
" 0.16417453365744444],\n", | |
" '38': [0.18640951977298856, 0.14317510157808844, 0.3503936188970017],\n", | |
" '39': [0.16088715088803351,\n", | |
" 0.17697406864583434,\n", | |
" 0.08108891469643228,\n", | |
" 0.08375170089817162,\n", | |
" 0.2657130876700894],\n", | |
" '40': [0.11255869185141058,\n", | |
" 0.03758326797288424,\n", | |
" 0.2902087100441498,\n", | |
" 0.01986510429366597,\n", | |
" 0.019805252089629306,\n", | |
" 0.5199789737482601],\n", | |
" '41': [0.16997074578365404,\n", | |
" 0.20183197316736273,\n", | |
" 0.12000486375592635,\n", | |
" 0.28176182705362535],\n", | |
" '42': [0.02541637822916804,\n", | |
" 0.21910272908918724,\n", | |
" 0.1666093206886059,\n", | |
" 0.3443539159607031,\n", | |
" 0.08021816759844957,\n", | |
" 0.11634472037496674],\n", | |
" '44': [0.20194666569397182, 0.29570050993204255],\n", | |
" '45': [0.2899186850351894, 0.3291387977407384],\n", | |
" '46': [0.06663914811214806,\n", | |
" 0.12307786884547084,\n", | |
" 0.04229191390190933,\n", | |
" 0.3513823124556439,\n", | |
" 0.32893135492113046,\n", | |
" 0.08767740176369734],\n", | |
" '47': [0.12093841184342884,\n", | |
" 0.11444740876038052,\n", | |
" 0.05989108930559947,\n", | |
" 0.2812981670286354,\n", | |
" 0.09839184911156434,\n", | |
" 0.05082171264210024,\n", | |
" 0.1782226975885081,\n", | |
" 0.0959886637197837],\n", | |
" '48': [0.01996953547482233,\n", | |
" 0.06405805592232551,\n", | |
" 0.12937020133795535,\n", | |
" 0.20505448218283542],\n", | |
" '49': [0.2499805395150025,\n", | |
" 0.20021716228005287,\n", | |
" 0.1495809103371144,\n", | |
" 0.25004714053805893,\n", | |
" 0.15017424732977155],\n", | |
" '50': [0.09497219872578576, 0.36564775752557827, 0.32170529674621084],\n", | |
" '51': [0.06738097877533665,\n", | |
" 0.04524654286767907,\n", | |
" 0.18198015605307716,\n", | |
" 0.06602455905684683,\n", | |
" 0.2220950071785863],\n", | |
" '53': [0.08923076093292966, 0.19979272321365937],\n", | |
" '54': [0.08127908619385915,\n", | |
" 0.19469160684842685,\n", | |
" 0.23554578751261734,\n", | |
" 0.10767874231249458,\n", | |
" 0.3808047771326015],\n", | |
" '55': [0.12978598701348362,\n", | |
" 0.0664719355819708,\n", | |
" 0.19015443302675836,\n", | |
" 0.2176464612575561],\n", | |
" '56': [0.22725424317733278,\n", | |
" 0.11266728662737108,\n", | |
" 0.3418603030298269,\n", | |
" 0.09096019910204023,\n", | |
" 0.09070674090697921,\n", | |
" 0.1365512271564498]}" | |
] | |
}, | |
"execution_count": 36, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"w_midx.groupby('focal').agg(list).to_dict()['weight']" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "16cc7a6e-2289-46ed-85c0-bb6deac4d98e", | |
"metadata": {}, | |
"source": [ | |
"These are aligned properly (i think), but that doesnt really matter anymore. This is just a convenience view. All the relationships between focal/neighbor/weight is handled by the multiindex" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "fc1e5839-4450-4864-8a52-71efb7f03837", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "f76b0712-6a84-4c8a-9529-606fb624a7b7", | |
"metadata": {}, | |
"source": [ | |
"### cardinalities" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 37, | |
"id": "f919cc85-5c38-4f9e-a0fb-21449dbbb454", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"{'01': 4,\n", | |
" '04': 4,\n", | |
" '05': 6,\n", | |
" '06': 3,\n", | |
" '08': 6,\n", | |
" '09': 3,\n", | |
" '10': 3,\n", | |
" '12': 2,\n", | |
" '13': 5,\n", | |
" '16': 6,\n", | |
" '17': 5,\n", | |
" '18': 4,\n", | |
" '19': 6,\n", | |
" '20': 4,\n", | |
" '21': 7,\n", | |
" '22': 3,\n", | |
" '23': 1,\n", | |
" '24': 4,\n", | |
" '25': 5,\n", | |
" '26': 3,\n", | |
" '27': 4,\n", | |
" '28': 4,\n", | |
" '29': 8,\n", | |
" '30': 4,\n", | |
" '31': 6,\n", | |
" '32': 5,\n", | |
" '33': 3,\n", | |
" '34': 3,\n", | |
" '35': 4,\n", | |
" '36': 5,\n", | |
" '37': 4,\n", | |
" '38': 3,\n", | |
" '39': 5,\n", | |
" '40': 6,\n", | |
" '41': 4,\n", | |
" '42': 6,\n", | |
" '44': 2,\n", | |
" '45': 2,\n", | |
" '46': 6,\n", | |
" '47': 8,\n", | |
" '48': 4,\n", | |
" '49': 5,\n", | |
" '50': 3,\n", | |
" '51': 5,\n", | |
" '53': 2,\n", | |
" '54': 5,\n", | |
" '55': 4,\n", | |
" '56': 6}" | |
] | |
}, | |
"execution_count": 37, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"w_us_rook.cardinalities" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 38, | |
"id": "d53a8874-a74e-4245-9d20-44a9c8149db1", | |
"metadata": {}, | |
"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>n_neighbors</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>focal</th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>01</th>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>04</th>\n", | |
" <td>4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>05</th>\n", | |
" <td>6</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>06</th>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>08</th>\n", | |
" <td>6</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>09</th>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>10</th>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>12</th>\n", | |
" <td>2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>13</th>\n", | |
" <td>5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>16</th>\n", | |
" <td>6</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" n_neighbors\n", | |
"focal \n", | |
"01 4\n", | |
"04 4\n", | |
"05 6\n", | |
"06 3\n", | |
"08 6\n", | |
"09 3\n", | |
"10 3\n", | |
"12 2\n", | |
"13 5\n", | |
"16 6" | |
] | |
}, | |
"execution_count": 38, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"w_midx.groupby('focal').count().rename(columns={'weight':'n_neighbors'}).head(10) # you get the idea (could rename the column if \"weight\" is confusing)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "ecc28369-7bf4-4772-a03b-dc2a7facfe40", | |
"metadata": {}, | |
"source": [ | |
"#### histogram" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 39, | |
"id": "8fbb3000-5435-423b-b365-a4ac3947089b", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"array([[<AxesSubplot: title={'center': '# neighbors'}>]], dtype=object)" | |
] | |
}, | |
"execution_count": 39, | |
"metadata": {}, | |
"output_type": "execute_result" | |
}, | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAABD4AAANlCAYAAACUuTlvAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8o6BhiAAAACXBIWXMAAB7CAAAewgFu0HU+AABVfklEQVR4nO3dd5RV1f03/s/Qm6A4iigoSkSMJfog2FGMoijBYIvGr4IlGhN51ETxa4piEmtETIzRRFDsNZZYgyKCIijGrvAooJEmOgaVMoWB+/uDxf2BtBmYuWXzeq3FWvvO2fecz527OTP3PfvsU5LJZDIBAAAAkKAG+S4AAAAAoL4IPgAAAIBkCT4AAACAZAk+AAAAgGQJPgAAAIBkCT4AAACAZAk+AAAAgGQJPgAAAIBkCT4AAACAZAk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bzz//fPz1r3+Nxx57LLbeeuu17mvhwoVxxhlnxAMPPLDKtlmzZsWsWbPiX//6V1x55ZUxYsSI6NOnT41qjFgWYB1//PHx/vvvr7XfhAkT4vjjj49Zs2atsYa33347+3oXL15sJhMAOecnDwDUg1deeSWGDh26xu2ZTCauv/76NW5/5pln4plnnlnpa61ataqz4GPJkiVx7LHHxujRo6NJkyax3377RefOnaOioiJeeumlbAjz7LPPxi9+8Yu4+eab17ivhQsXxuGHH77Swqzbb7997LXXXrHZZpvFvHnz4pVXXolZs2ZFeXl5DBo0KL755pv41a9+tUGv4frrr4+LL744+7hZs2bRq1ev6NChQ5SVlcWYMWNizpw50bdv3zj//PNrte+6/P6s6LTTTsuGAD169IhddtklKisrY+LEiTF9+vSIiJg0aVIccsgh8corr0Tbtm1Xu59FixbFIYccEq+99lr2a1tvvXUceOCB0apVq5g6dWq8/PLLsWTJkpgzZ07069cv7rvvvjjuuOPWWeOXX34ZRxxxRHz66afRrFmzOPDAA2O77baL+fPnr3RHohkzZsThhx8e8+fPj4iIxo0bR/fu3eM73/lOtGjRIhYuXBiffPJJvP3229k7FQFAXmQAgDp32WWXZSKiTv9ddtllG1TT7bffnt1X06ZNMxGR6dOnT2bmzJkr9Vu8eHHmwgsvzPYtKSnJfPzxx2vc76mnnprt27lz58xzzz23Sp/q6urMX//61+xxGzZsmHnllVdWu78BAwZk93f77bevts97772XadKkSbbfUUcdlfn8889X6rNw4cLMT3/605Veb0RkBgwYkLPvz5gxY7L9lte7/fbbZ1599dVV+t5xxx0r1Xnqqaeudp+ZTCZzzjnnZPs1bNgwc/3112eWLFmyUp8PP/ww061bt2y/1q1bZ6ZPn77a/a04Xhs1apSJiMxxxx2X+eKLL1bqt2TJkkxVVVUmk8lkzjvvvOxzDjzwwMysWbNWu+/FixdnXnzxxczJJ5+cqa6uXuNrAoD6IvgAgBz561//mv2gOHHixJW2/fe//82UlJRkIiLzy1/+sl6Ov+IH++UfVhcvXrzavkuXLs1079492/fqq69ebb9x48Zl+3To0CEzZ86ctdZw2223ZfsfccQRq+1Tk+DjuOOOy/bZa6+9MpWVlWs85vHHH7/S665J8FFX358Vg4+IyLRs2TIzderUNdZ69913r9T//fffX6XP1KlTMw0aNMj2+fOf/7zG/f33v//NdOrUKdv3tNNOW22/bwd1vXv3XiVI+bYVQ5WPPvporX0BIJ8sbgoAOfLiiy9GxLJLVrp167bStpdeeim7UOZBBx2Uk3qGDRu2xvUWSkpK4rTTTss+njRp0mr7rXi5zlVXXRVbbbXVWo85cODA6Nq1a0RE/Otf/8ouPlob//3vf+Pxxx/PPr722mujSZMma+w/dOjQaNCg9r/y1MX359t++ctfRufOnde4/eSTT479998/+/jWW29dpc+tt96aXQB19913X+t6KZtttllcc8012cf33ntvfP311+us84Ybbljn92zFy1e22GKLde4TAPJF8AEAOTJ27NiIiDjggANW+UC9fFuDBg3igAMOqPdadthhh1XCl2/bc889s+1PPvlkle3V1dXx3HPPRUREo0aN4thjj13ncUtKSqJXr14RsWydk1deeaUWVS/zyiuvZBczbd++fRx88MFr7d+xY8fo2bNnrY5RF9+f1Tn11FPX2WfAgAHZ9pgxY1bZ/sILL2Tbp5122koL5K5O//79s2uFVFZWrnRnodXZfffdY+edd15nndtuu222fdNNN62zPwDki8VNASAHJk+eHHPnzo2IWO0H9eXBx2677RabbbZZvdez2267rbPP5ptvnm2vbpbAO++8k71VarNmzeKiiy6q0bFXnB0xY8aMGj1nRSveTrV79+7r/OC/vN/yGTc1URffn28rLS1d62yP5Va8lfF7770XixcvjsaNG0fEsrBoxde/4uyQNWncuHH06NEjnn322YiIeOONN+KII45YY/91BT7L/ehHP4rRo0dHRMSvf/3rGDVqVJx88slx2GGHRadOnWq0DwDIBcEHAOTAih+6vx18zJ8/P/thNleXubRp02adfZZ/2I6IlW4Xu9zs2bOz7QULFqzXX/3nzZtX6+eseHlMhw4davScbbbZplbHqIvvz7etOENibTp27JhtL1myJObNmxdbbrllRCwLWFY81nbbbVejfa4YRKzr8qKaXrZyxhlnxKh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4zDPPXKXPT37yk2jQYNmvcG+88Ub8/e9/X+P+vv766xg8eHD28UknnVSjO9bUxLruDrPcipfjWN8DgHwQfABAPSorK4spU6ZExOpndCwPPjp16rTSbUyLxUEHHRQDBgzIPj799NPjoosuys4w+LbKysp4/PHHo3///iuFF7V12WWXZWd9vP7663HMMcfEF198sVKfRYsWxTnnnBMPPvjgKoFTPjRp0iQWLlwYhx122GovvbnrrrvijDPOyD7+n//5n9hll11W6de5c+c4++yzs4/PPffcuOmmm1ZZY2XatGnRu3fvbNDSunXr+O1vf1tXLye23XbbOOuss+LFF19cY7A0ceLEle5SVIiL9AKQPnd1AYB6tHy2R8SqwceSJUuy62IU22UuK/rb3/4Wc+bMiVGjRkUmk4nrrrsu/vznP0f37t2jc+fO0bx58/j6669j2rRp8e6770ZFRUVERHTr1m29j7nbbrvFFVdckZ3N8NRTT8V2220XvXr1im222Sa+/PLLeOGFF+Krr76KTTfdNC644IK47LLLIiKysyVybd99943NN988Hnnkkdh7772jR48escsuu0RVVVVMmDBhpZkgO+64Y9xwww1r3Nd1110Xr7/+ekyaNCmqq6vj3HPPjauvvjoOOOCAaNWqVUybNi3GjRuXDSQaNWoUI0aMiO23377OXk95eXnceuutceutt8Ymm2wSe+yxR2y77bbRsmXLbOD3wQcfZPtvscUWBbteDQBpE3wAQD1aHnw0aNAg9ttvv5W2vfnmm7FgwYKIKM7LXJZr2rRpPP3003H55ZfH0KFDY9GiRVFVVRXjx49f6bKNFTVu3Dj22WefDTruRRddFNXV1XHppZdGdXV1lJeXx9NPP71Sn/bt28fDDz8c77//fvZrdXk719oaOXJkVFdXxz//+c949dVX49VXX12lT7du3eLxxx+PzTfffI37adGiRbzwwgtxxhlnxIMPPhgRy+5wc//996/St3379jFixIjo06dP3b2QWHZr3eXjd/78+WtdR+V73/te3H///bH11lvXaQ0AUBOCDwCoR8s/DH7ve9+L1q1br3ZbRHEHHxHLbrv6u9/9LgYNGhR33nlnPP/88/HBBx9EWVlZLF68OFq3bh3bbbdd7LbbbtGrV6848sgj62S9h0suuST69u0bf/nLX+L555+P2bNnR4sWLaJTp05x7LHHxllnnRWlpaUrfa833XTTDT7u+tpkk03isccei3/84x9xxx13xNtvvx1z586NNm3axG677RYnn3xyDBgwIBo2bLjOfbVq1SoeeOCBOP/88+Ouu+6KF198MWbPnh3l5eVRWloau+66a/Tt2zdOP/30aNmyZZ2/li+//DLGjRsXY8eOjUmTJsVHH30Uc+fOjYqKimjRokV06NAhunXrFscee2z069cvbzNtAKAkU5N7wAEAFLGTTz457r333oiIuO++++LEE0/Mc0UAQK4IPgCApC1cuDA6dOgQX331VURETJ06NTp37pzfogCAnDHnEABI2m9+85ts6LF8wVUAYOMh+AAAitLDDz8cF110UUydOnW128vKyuJnP/vZSndHueiii3JUHQBQKFzqAgAUpZEjR8Zpp50WERFdunSJ3XbbLTbffPOorKyMjz/+OF599dWorKzM9j/55JPj7rvvzle5AECeuKsLAFD0Pvzww/jwww9Xu61hw4bx85//PK6//vocVwUAFAIzPgCAolRVVRXPPfdcPPvss/HGG2/E3Llzo6ysLBYtWhSbbbZZdOrUKQ4++OA4/fTTY6eddsp3uQBAngg+AAAAgGRZ3BQAAABIluADAAAASJbgAwAAAEiW4AMAAABIluADAAAASJbgAwAAAEhWo3wXUAwqKiri3XffjYiILbbYIho18m0DAACAulZdXR1ffPFFRETstttu0axZsw3ep0/wNfDuu+9Gjx498l0GAAAAbDRee+216N69+wbvx6UuAAAAQLLM+KiBLbbYItt+7bXXon379nmspmbKy8tj3LhxERHRs2fPaN68eZ4rIteMgY2b9x9jAGMAYwBjgGIcA3PmzMlecbHiZ/ENIfiogRXX9Gjfvn106NAhj9XUTHl5eZSWlkZERIcOHYpigFO3jIGNm/cfYwBjAGMAY4BiHwN1tb6mS10AAACAZAk+AAAAgGQJPgAAAIBkCT4AAACAZAk+AAAAgGQJPgAAAIBkCT4AAACAZAk+AAAAgGQJPgAAAIBkCT4AAACAZAk+AAAAgGQJPgAAAIBkCT4AAACAZAk+AAAA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AAAAAMkSfAAAAADJEnwAAAAAyRJ8AAAAAMkqquCjqqoqRowYEUcccUS0b98+mjZtGq1atYqddtopTj/99Jg4cWK+SwQAAAAKSKN8F1BTM2bMiKOOOirefffdlb5eVVUVH374YXz44Ydx++23xwUXXBBDhw6NkpKSPFUKAAAAFIqimPFRXV29Uuix++67x8iRI2PChAkxatSouPTSS6Nly5YRETFs2LC47rrr8lkuAAAAUCCKYsbH448/ng099t1333jppZeiYcOG2e2HHXZY9OvXL/bdd99YvHhxXHXVVXHBBRdEo0ZF8fIAAACAelIUMz7Gjx+fbV9yySUrhR7LdevWLfr27RsREfPmzYspU6bkrD4AAACgMBVF8FFVVZVt77DDDmvs17lz52y7srKyXmsCAAAACl9RBB9dunTJtqdPn77GftOmTYuIiJKSkthxxx3rvS4AAACgsBXFIhgnnXRS/Pa3v41vvvkmrrnmmjjyyCNXudzlzTffjKeeeioiIk488cRo3bp1jfc/c+bMtW6fM2dOtl1eXh7l5eW1qD4/KioqVttm45HiGGjTJJPvEopG68aZ1bZrohjOcamozzG9IWOANOR6DDh35EZtzhvOA+svlfGc4u+D1E4xjoH6+P9XkslkiuIs+Oijj8bJJ58c5eXlseeee8b5558fXbp0iQULFsT48eNj6NChMX/+/Nhjjz3imWeeia222qrG+67NrW+HDx8epaWl6/MSAAAAgLUoKyuLM888MyIiZsyYER06dNjgfRbFjI+IiP79+8frr78e119/fdx2220xYMCAlba3a9cuLr/88jjrrLOyt7YFAAAANm5FE3wsXrw47r333njiiSdidZNU5s6dG/fdd1906dIljjrqqFrte8aMGWvdPmfOnOjRo0dERPTs2bNOEqf6VlFREePGjYuIZTU3a9YszxWRaymOgX2uGp3vEopG68aZuHD3pRERcd07DeKbxTWf2Tbxku/XV1l8S32O6Q0ZA6Qh12PAuSM3anPecB5Yf6mM5xR/H6R2inEMrGspivVRFMHHwoUL48gjj4xx48ZFw4YNY/DgwXHaaafFDjvsEBUVFfHqq6/G7373u3j55ZfjBz/4QQwbNizOO++8Gu+/NkF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u+/GpZdeGs8880xEROy3337x0ksvRYMGNZ/MUlJSUuO+w4cPt84IAAAA1IOysrI488wzIyJixowZ0aFDhw3eZ8Ff6rJw4cKIiKisrIyGDRvGM888E2effXZsscUW0bRp09hrr73iySefjD59+kRExCuvvBKPPPJIPksGAAAACkTBz/ho1apVNvw48cQT47777lttv/fffz923XXXiIg45phj4h//+EeNj1GTS1169OgREREffvhhnSRO9a2ioiLGjRsXERE9e/aMZs2a5bkici3FMbDPVaPzXULRaN04ExfuvjQiIq57p0F8s7jmM9smXvL9+iqLb6nPMb0hY4A05HoMOHfkRm3OG84D6y+V8Zzi74PUTjGOgZkzZ0aXLl0iou5mfBT8Gh+bbLJJNvhYPqtjdXbZZZfYZpttYtasWTFp0qRaHaM238jmzZtH8+bNa7X/fGvWrFnR1UzdSmUMfF3lF7b18c3iklp971IYK8UiV2O6tmOA9ORiDDh35Mb6vo/OA7WT4nhO5fdB1l+xjIH6qLHgL3Xp2LFjtr2ugGJ5388//7xeawIAAACKQ8EHH7vssku2vWTJkrX2Xb69UaOCn8gCAAAA5EDBBx89e/bMtqdNm7bWvtOnT4+IiG222aZeawIAAACKQ8EHH/369YvGjRtHRKz1bi1jx46NL7/8MiIiDjzwwJzUBgAAABS2gg8+Nt988+w9fJ977rm4//77V+kzf/78OP/887OPzz777FyVBwAAABSwgg8+IiIuv/zy2HbbbSMi4pRTTolBgwbFmDFj4t///neMHDkyevToEW+99VZERJxzzjnRvXv3PFYLAAAAFIqiWAV0iy22iGeffTb69esXU6dOjb/85S/xl7/8ZZV+p59+evzpT3/KQ4UAAABAISqKGR8RETvvvHO89dZb8cc//jH23nvvaNu2bTRp0iQ6dOgQP/rRj+KFF16IESNGZNcDAQAAACiKGR/LtWzZMi688MK48MIL810KAAAAUASKZsYHAAAAQG0JPgAAAIBkCT4AAACAZAk+AAAAgGQJPgAAAIBkCT4AAACAZAk+AAAAgGQJPgAAAIBkCT4AAACAZAk+AAAAgGQJPgAAAIBkCT4AAACAZAk+AAA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oll17Kd4nUo2+++Sbuv//++OUvfxkHHXRQfOc734k2bdpEkyZNYsstt4yDDz44rr322vjyyy/zXSp5MHjw4OzPhJKSknjxxRfzXRL1YMX3eG3/Dj744HyXSg6UlZXFtddeG/vvv39stdVW0bRp09h6661j7733josuuigmTJiQ7xKpYwcffHCNzwN+HqSvqqoqRowYEUcccUS0b98++9lgp512itNPPz0mTpyY7xJzqiSTyWTyXQQbrqSkZI3bBgwYECNHjsxdMeTcQQcdFOPGjVtnv1NOOSWGDx8eTZo0yUFV5NLzzz8fhx122Dr7lZaWxt133x2HH354DqqiELz99tux1157RXV1dfZrY8aM8eE3QWv7XWBFBx10kA87iXvooYfinHPOWWvYffTRR8djjz2Wu6KodwcffHCMHTu2xv0bNGgQn376aWyzzTb1WBX5MGPGjDjqqKPi3XffXWu/Cy64IIYOHVrjnx/FrFG+C6DudezYMXbeeecYNWpUvkshR2bNmhUREVtvvXUcf/zxceCBB8a2224bS5YsiQkTJsTQoUNj1qxZcdddd0V1dXXce++9ea6Y+tCxY8fo1atXdOvWLTp27Bjt27ePpUuXxsyZM+Phhx+ORx55JMrKyqJfv34xadKk2H333fNdMvVs6dKl8ZOf/CSqq6tjyy23jM8//zzfJZED55xzTvzsZz9b4/aWLVvmsBpy7c4774zTTjstli5dGltuuWWcc845ccABB0Tbtm3js88+i2nTpsUTTzwRjRs3znep1LHbb789Fi5cuNY+H3zwQfzoRz+KiIjvf//7Qo8EVVdXrxR67L777vGLX/widtppp5g/f368/PLLMXTo0Fi4cGEMGzYs2rdvHxdddFGeq86BDEm49NJLM0888UTms88+y2QymczHH3+ciYhMRGQGDBiQ3+Kod0cddVTmgQceyFRXV692+xdffJHp0qVLdkyMGzcuxxVS39b03q/o0UcfzY6BY445JgdVkW/Dhg3LRESma9eumUsuuST7/o8ZMybfpVEPlr+/l112Wb5LIU8++OCDTNOmTTMRkTnwwAMzX3311Rr7VlZW5rAyCsXgwYOz54q77ror3+VQDx5++OHse7zvvvuu9nfE119/PdO4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bDHHnvExIkT449//KNfeBL18ssvx/Dhw6NRo0Zxyy23eJ83Mi1atIgTTzwxbr311njppZfizTffjFGjRsWvf/3r2HzzzSMi4rHHHoujjz46Fi9enOdqqWv//e9/I2LZWh833XRTbLrppnHLLbfE559/HhUVFTFp0qTo06dPRES89957cfzxx8fSpUvzWTI55DKXjUv//v3j9ddfjzPOOCPeeuutGDBgQOy7775x2GGHxZAhQ6JFixZx/fXXx8svvxxbbbVVvsvNCTM+IHFjx46N//3f/42IiC233DJuvvnmPFdEffvhD3+YDbfKy8tj2rRp8eCDD8ajjz4aJ598ctxwww3ZlbxJR1VVVZx11lmRyWTiggsuiN122y3fJZFjs2bNik033XSVrx922GExaNCg6NOnT7z55psxduzYuPnmm+P//t//m/siqTfL/5pfWVkZDRs2jGeeeSb22Wef7Pa99tornnzyyejbt28888wz8corr8QjjzwSxx13XL5KJkdmzpwZL774YkRE7LPPPiutAUGaFi9eHPfee2888cQTkclkVtk+d+7cuO+++6JLly5x1FFH5aHC3DPjAxL2/vvvR//+/aO6ujqaNm0aDz74oFsebwQ23XTT2HXXXWPXXXeN7t27x4knnhiPPPJI3HnnnTF9+vQ4+uijY+TIkfkukzp25ZVXxuTJk2PbbbeNyy67LN/lkAerCz2Wa9euXTz88MPZW5jeeOONOaqKXGnWrFm2ffzxx68UeizXoEGDlRY8vu+++3JSG/l19913Z2f3DBgwIM/VUN8WLlwYhx56aFxxxRXx5ZdfxuDBg2Py5MlRWVkZX3/9dYwaNSoOOOCAmDRpUvzgBz+IP/3pT/kuOScEH5Cojz/+OHr37h3z5s2Lhg0bxn333RcHHXRQvssij0455ZTs1OZzzz035s2bl++SqCNTpkyJq666KiKWfaBdfttiWNEOO+wQhx12WEQsW/dj9uzZea6IurTJJptk28svaVmdXXbZJbbZZpuIiJg0aVK910X+3XXXXRER0bRp0/jRj36U52qob5dddlmMGzcuIiJGjBgR11xzTXTt2jWaNGkSrVu3jsMOOyzGjBkTvXr1ikwmE7/4xS/inXfeyXPV9U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aMmRIXH755RGxbMbHwQcfnN+CqFOdOnWKxYsXx7HHHhv77rtvdOrUKZo3bx5lZWXx4osvxi233JL9K/8BBxwQzz//fDRt2jTPVVPXvvjii9hrr73i008/jUaNGsVPf/rTOOaYY6J169bx7rvvxjXXXJO9lv+cc86Jv/71r3mumPoyb968aN++fVRWVsauu+4a7777br5LIkemTJkS3bp1i0WLFkVExA9+8IMYMGBA7LDDDlFRURETJ06MG264IT799NOIiPj+978fzz//fD5LzgnBRyIGDhwYd9xxR437e9vTsraQY3W22267+OSTT+qnGPKiU6dONVqstEOHDnHbbbdlb2nJxkPwkbaangOOPfbYGD58eGy66ab1XxR5MXny5OjXr99KfxD7ttNPPz1uueWW7KUxpOeWW26Jc845JyIirr322uwfRNk4PP/883HSSSdFWVnZWvsdcsgh8fDDD28Ud/txoRdAAkaPHh3PP/98jBkzJiZPnhxz586NL7/8Mpo1axbt2rWLPfbYI/r27RsnnHBCtGjRIt/lAnXsjjvuiLFjx8aECRNi+vTpUVZWFt988020atUqOnbsGPvtt18MGDAg9t1333yXSj3beeed46233oqbb745Hn744fjoo49iwYIFseWWW8b+++8fZ599dvTq1SvfZVLP7rrrroiIaNiwYZx88sl5roZcO/TQQ2PKlCkxYsSIeOaZZ+L999+Pr776Kho1ahRbbbVVdO/ePX784x9Hv379av0H1GJlxgcAAACQLIubAgAAAMkSfAAAAADJEnwAAAAAyRJ8AAAAAMkSfAAAAADJEnwAAAAAyRJ8AAAAAMkSfAAAAADJEnwAAAAAyRJ8AAAAAMkSfAAAAADJEnwAAAAAyRJ8AAAAAMkSfAAAAADJEnwAAAAAyRJ8AAAAAMkSfAAAAADJEnwAAAAAyRJ8AAAAAMkSfAAAAADJEnwAAAAAyRJ8AAAAAMkSfAAAAADJEnwAAAAAyRJ8AAAAAMn6/wCH1dnn9lwcxQAAAABJRU5ErkJggg==\n", | |
"text/plain": [ | |
"<Figure size 640x480 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"image/png": { | |
"height": 434, | |
"width": 543 | |
} | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"w_midx.groupby('focal').count().rename({'weight':'# neighbors'}, axis=1).hist()" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "1fb20bdd-9c2f-40e5-8727-e3228af4425e", | |
"metadata": {}, | |
"source": [ | |
"#### stats" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 40, | |
"id": "617118e3-5399-4f46-a395-0ac08e24b214", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"8" | |
] | |
}, | |
"execution_count": 40, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"w_us_rook.max_neighbors" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 41, | |
"id": "f0324407-f24d-480d-b3f2-113ef5adf11c", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"8" | |
] | |
}, | |
"execution_count": 41, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"# max\n", | |
"w_midx.groupby('focal').count().max()[0]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 42, | |
"id": "bc2afd58-088a-4689-a82f-10fb2c9b1081", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"1" | |
] | |
}, | |
"execution_count": 42, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"w_midx.groupby('focal').count().min()[0]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 43, | |
"id": "49e9ba5c-99de-4e96-a937-bbd62421d49c", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"1.5360257159305635" | |
] | |
}, | |
"execution_count": 43, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"w_midx.groupby('focal').count().std(ddof=0)[0]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 44, | |
"id": "3e291fb4-29b4-467b-98e5-f6cb68a3d207", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"1.5360257159305635" | |
] | |
}, | |
"execution_count": 44, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"w_us_rook.sd" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 45, | |
"id": "023245ba-6836-4b08-8c41-14fd493b120a", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import numpy as np" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "8d423ea6-008d-468a-be5f-f093e256c4bb", | |
"metadata": { | |
"tags": [] | |
}, | |
"source": [ | |
"### To Dense/Sparse" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "2d748a80-b988-4c2d-91ed-79e7405d95ff", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 46, | |
"id": "671e8feb-8574-4c63-a15f-4a97ee438cdd", | |
"metadata": {}, | |
"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>neighbor</th>\n", | |
" <th>01</th>\n", | |
" <th>04</th>\n", | |
" <th>05</th>\n", | |
" <th>06</th>\n", | |
" <th>08</th>\n", | |
" <th>09</th>\n", | |
" <th>10</th>\n", | |
" <th>12</th>\n", | |
" <th>13</th>\n", | |
" <th>16</th>\n", | |
" <th>...</th>\n", | |
" <th>46</th>\n", | |
" <th>47</th>\n", | |
" <th>48</th>\n", | |
" <th>49</th>\n", | |
" <th>50</th>\n", | |
" <th>51</th>\n", | |
" <th>53</th>\n", | |
" <th>54</th>\n", | |
" <th>55</th>\n", | |
" <th>56</th>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>focal</th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" <th></th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>01</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.189223</td>\n", | |
" <td>0.258420</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.150561</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>04</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.147443</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.214886</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>05</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.117643</td>\n", | |
" <td>0.061991</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>06</th>\n", | |
" <td>NaN</td>\n", | |
" <td>0.081143</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>08</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.181734</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.226855</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>09</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>10</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>12</th>\n", | |
" <td>0.079391</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.107079</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>13</th>\n", | |
" <td>0.221582</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.218836</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.063932</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>16</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.104820</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.109332</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.086829</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>17</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.142067</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>18</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>19</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>0.080670</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.077443</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>20</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.142627</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>21</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.285393</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.099387</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.069921</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>22</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.088323</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.127462</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>23</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>24</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.086503</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.064516</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.161906</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>25</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.134738</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.061238</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>26</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.101971</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>27</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>0.094867</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.161454</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>28</th>\n", | |
" <td>0.212286</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.249232</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.095715</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>29</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.249002</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.046221</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>30</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.318344</td>\n", | |
" <td>...</td>\n", | |
" <td>0.027862</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.217694</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>31</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.128436</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>0.341815</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.085528</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>32</th>\n", | |
" <td>NaN</td>\n", | |
" <td>0.125471</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.410579</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.126212</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.211744</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>33</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.368946</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>34</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.015470</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>35</th>\n", | |
" <td>NaN</td>\n", | |
" <td>0.240182</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.257129</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.356202</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>36</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.044394</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.095428</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>37</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.035212</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.110594</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.164175</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>38</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>0.350394</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>39</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.265713</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>40</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.112559</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.037583</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.519979</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>41</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.169971</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.201832</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.281762</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>42</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.025416</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.116345</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>44</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.201947</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>45</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.289919</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>46</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.087677</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>47</th>\n", | |
" <td>0.120938</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.114447</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.059891</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.095989</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>48</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.019970</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>49</th>\n", | |
" <td>NaN</td>\n", | |
" <td>0.249981</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.200217</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.149581</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.150174</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>50</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>51</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.066025</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.222095</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>53</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.089231</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>54</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.380805</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>55</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>...</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>56</th>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.227254</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.112667</td>\n", | |
" <td>...</td>\n", | |
" <td>0.090707</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>0.136551</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" <td>NaN</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"<p>48 rows × 48 columns</p>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
"neighbor 01 04 05 06 08 09 \\\n", | |
"focal \n", | |
"01 NaN NaN NaN NaN NaN NaN \n", | |
"04 NaN NaN NaN 0.147443 NaN NaN \n", | |
"05 NaN NaN NaN NaN NaN NaN \n", | |
"06 NaN 0.081143 NaN NaN NaN NaN \n", | |
"08 NaN NaN NaN NaN NaN NaN \n", | |
"09 NaN NaN NaN NaN NaN NaN \n", | |
"10 NaN NaN NaN NaN NaN NaN \n", | |
"12 0.079391 NaN NaN NaN NaN NaN \n", | |
"13 0.221582 NaN NaN NaN NaN NaN \n", | |
"16 NaN NaN NaN NaN NaN NaN \n", | |
"17 NaN NaN NaN NaN NaN NaN \n", | |
"18 NaN NaN NaN NaN NaN NaN \n", | |
"19 NaN NaN NaN NaN NaN NaN \n", | |
"20 NaN NaN NaN NaN 0.142627 NaN \n", | |
"21 NaN NaN NaN NaN NaN NaN \n", | |
"22 NaN NaN 0.088323 NaN NaN NaN \n", | |
"23 NaN NaN NaN NaN NaN NaN \n", | |
"24 NaN NaN NaN NaN NaN NaN \n", | |
"25 NaN NaN NaN NaN NaN 0.134738 \n", | |
"26 NaN NaN NaN NaN NaN NaN \n", | |
"27 NaN NaN NaN NaN NaN NaN \n", | |
"28 0.212286 NaN 0.249232 NaN NaN NaN \n", | |
"29 NaN NaN 0.249002 NaN NaN NaN \n", | |
"30 NaN NaN NaN NaN NaN NaN \n", | |
"31 NaN NaN NaN NaN 0.128436 NaN \n", | |
"32 NaN 0.125471 NaN 0.410579 NaN NaN \n", | |
"33 NaN NaN NaN NaN NaN NaN \n", | |
"34 NaN NaN NaN NaN NaN NaN \n", | |
"35 NaN 0.240182 NaN NaN 0.257129 NaN \n", | |
"36 NaN NaN NaN NaN NaN 0.044394 \n", | |
"37 NaN NaN NaN NaN NaN NaN \n", | |
"38 NaN NaN NaN NaN NaN NaN \n", | |
"39 NaN NaN NaN NaN NaN NaN \n", | |
"40 NaN NaN 0.112559 NaN 0.037583 NaN \n", | |
"41 NaN NaN NaN 0.169971 NaN NaN \n", | |
"42 NaN NaN NaN NaN NaN NaN \n", | |
"44 NaN NaN NaN NaN NaN 0.201947 \n", | |
"45 NaN NaN NaN NaN NaN NaN \n", | |
"46 NaN NaN NaN NaN NaN NaN \n", | |
"47 0.120938 NaN 0.114447 NaN NaN NaN \n", | |
"48 NaN NaN 0.019970 NaN NaN NaN \n", | |
"49 NaN 0.249981 NaN NaN 0.200217 NaN \n", | |
"50 NaN NaN NaN NaN NaN NaN \n", | |
"51 NaN NaN NaN NaN NaN NaN \n", | |
"53 NaN NaN NaN NaN NaN NaN \n", | |
"54 NaN NaN NaN NaN NaN NaN \n", | |
"55 NaN NaN NaN NaN NaN NaN \n", | |
"56 NaN NaN NaN NaN 0.227254 NaN \n", | |
"\n", | |
"neighbor 10 12 13 16 ... 46 47 \\\n", | |
"focal ... \n", | |
"01 NaN 0.189223 0.258420 NaN ... NaN 0.150561 \n", | |
"04 NaN NaN NaN NaN ... NaN NaN \n", | |
"05 NaN NaN NaN NaN ... NaN 0.117643 \n", | |
"06 NaN NaN NaN NaN ... NaN NaN \n", | |
"08 NaN NaN NaN NaN ... NaN NaN \n", | |
"09 NaN NaN NaN NaN ... NaN NaN \n", | |
"10 NaN NaN NaN NaN ... NaN NaN \n", | |
"12 NaN NaN 0.107079 NaN ... NaN NaN \n", | |
"13 NaN 0.218836 NaN NaN ... NaN 0.063932 \n", | |
"16 NaN NaN NaN NaN ... NaN NaN \n", | |
"17 NaN NaN NaN NaN ... NaN NaN \n", | |
"18 NaN NaN NaN NaN ... NaN NaN \n", | |
"19 NaN NaN NaN NaN ... 0.080670 NaN \n", | |
"20 NaN NaN NaN NaN ... NaN NaN \n", | |
"21 NaN NaN NaN NaN ... NaN 0.285393 \n", | |
"22 NaN NaN NaN NaN ... NaN NaN \n", | |
"23 NaN NaN NaN NaN ... NaN NaN \n", | |
"24 0.086503 NaN NaN NaN ... NaN NaN \n", | |
"25 NaN NaN NaN NaN ... NaN NaN \n", | |
"26 NaN NaN NaN NaN ... NaN NaN \n", | |
"27 NaN NaN NaN NaN ... 0.094867 NaN \n", | |
"28 NaN NaN NaN NaN ... NaN 0.095715 \n", | |
"29 NaN NaN NaN NaN ... NaN 0.046221 \n", | |
"30 NaN NaN NaN 0.318344 ... 0.027862 NaN \n", | |
"31 NaN NaN NaN NaN ... 0.341815 NaN \n", | |
"32 NaN NaN NaN 0.126212 ... NaN NaN \n", | |
"33 NaN NaN NaN NaN ... NaN NaN \n", | |
"34 0.015470 NaN NaN NaN ... NaN NaN \n", | |
"35 NaN NaN NaN NaN ... NaN NaN \n", | |
"36 NaN NaN NaN NaN ... NaN NaN \n", | |
"37 NaN NaN 0.035212 NaN ... NaN 0.110594 \n", | |
"38 NaN NaN NaN NaN ... 0.350394 NaN \n", | |
"39 NaN NaN NaN NaN ... NaN NaN \n", | |
"40 NaN NaN NaN NaN ... NaN NaN \n", | |
"41 NaN NaN NaN 0.201832 ... NaN NaN \n", | |
"42 0.025416 NaN NaN NaN ... NaN NaN \n", | |
"44 NaN NaN NaN NaN ... NaN NaN \n", | |
"45 NaN NaN 0.289919 NaN ... NaN NaN \n", | |
"46 NaN NaN NaN NaN ... NaN NaN \n", | |
"47 NaN NaN 0.059891 NaN ... NaN NaN \n", | |
"48 NaN NaN NaN NaN ... NaN NaN \n", | |
"49 NaN NaN NaN 0.149581 ... NaN NaN \n", | |
"50 NaN NaN NaN NaN ... NaN NaN \n", | |
"51 NaN NaN NaN NaN ... NaN 0.066025 \n", | |
"53 NaN NaN NaN 0.089231 ... NaN NaN \n", | |
"54 NaN NaN NaN NaN ... NaN NaN \n", | |
"55 NaN NaN NaN NaN ... NaN NaN \n", | |
"56 NaN NaN NaN 0.112667 ... 0.090707 NaN \n", | |
"\n", | |
"neighbor 48 49 50 51 53 54 \\\n", | |
"focal \n", | |
"01 NaN NaN NaN NaN NaN NaN \n", | |
"04 NaN 0.214886 NaN NaN NaN NaN \n", | |
"05 0.061991 NaN NaN NaN NaN NaN \n", | |
"06 NaN NaN NaN NaN NaN NaN \n", | |
"08 NaN 0.181734 NaN NaN NaN NaN \n", | |
"09 NaN NaN NaN NaN NaN NaN \n", | |
"10 NaN NaN NaN NaN NaN NaN \n", | |
"12 NaN NaN NaN NaN NaN NaN \n", | |
"13 NaN NaN NaN NaN NaN NaN \n", | |
"16 NaN 0.104820 NaN NaN 0.109332 NaN \n", | |
"17 NaN NaN NaN NaN NaN NaN \n", | |
"18 NaN NaN NaN NaN NaN NaN \n", | |
"19 NaN NaN NaN NaN NaN NaN \n", | |
"20 NaN NaN NaN NaN NaN NaN \n", | |
"21 NaN NaN NaN 0.099387 NaN 0.069921 \n", | |
"22 0.127462 NaN NaN NaN NaN NaN \n", | |
"23 NaN NaN NaN NaN NaN NaN \n", | |
"24 NaN NaN NaN 0.064516 NaN 0.161906 \n", | |
"25 NaN NaN 0.061238 NaN NaN NaN \n", | |
"26 NaN NaN NaN NaN NaN NaN \n", | |
"27 NaN NaN NaN NaN NaN NaN \n", | |
"28 NaN NaN NaN NaN NaN NaN \n", | |
"29 NaN NaN NaN NaN NaN NaN \n", | |
"30 NaN NaN NaN NaN NaN NaN \n", | |
"31 NaN NaN NaN NaN NaN NaN \n", | |
"32 NaN 0.211744 NaN NaN NaN NaN \n", | |
"33 NaN NaN 0.368946 NaN NaN NaN \n", | |
"34 NaN NaN NaN NaN NaN NaN \n", | |
"35 0.356202 NaN NaN NaN NaN NaN \n", | |
"36 NaN NaN 0.095428 NaN NaN NaN \n", | |
"37 NaN NaN NaN 0.164175 NaN NaN \n", | |
"38 NaN NaN NaN NaN NaN NaN \n", | |
"39 NaN NaN NaN NaN NaN 0.265713 \n", | |
"40 0.519979 NaN NaN NaN NaN NaN \n", | |
"41 NaN NaN NaN NaN 0.281762 NaN \n", | |
"42 NaN NaN NaN NaN NaN 0.116345 \n", | |
"44 NaN NaN NaN NaN NaN NaN \n", | |
"45 NaN NaN NaN NaN NaN NaN \n", | |
"46 NaN NaN NaN NaN NaN NaN \n", | |
"47 NaN NaN NaN 0.095989 NaN NaN \n", | |
"48 NaN NaN NaN NaN NaN NaN \n", | |
"49 NaN NaN NaN NaN NaN NaN \n", | |
"50 NaN NaN NaN NaN NaN NaN \n", | |
"51 NaN NaN NaN NaN NaN 0.222095 \n", | |
"53 NaN NaN NaN NaN NaN NaN \n", | |
"54 NaN NaN NaN 0.380805 NaN NaN \n", | |
"55 NaN NaN NaN NaN NaN NaN \n", | |
"56 NaN 0.136551 NaN NaN NaN NaN \n", | |
"\n", | |
"neighbor 55 56 \n", | |
"focal \n", | |
"01 NaN NaN \n", | |
"04 NaN NaN \n", | |
"05 NaN NaN \n", | |
"06 NaN NaN \n", | |
"08 NaN 0.226855 \n", | |
"09 NaN NaN \n", | |
"10 NaN NaN \n", | |
"12 NaN NaN \n", | |
"13 NaN NaN \n", | |
"16 NaN 0.086829 \n", | |
"17 0.142067 NaN \n", | |
"18 NaN NaN \n", | |
"19 0.077443 NaN \n", | |
"20 NaN NaN \n", | |
"21 NaN NaN \n", | |
"22 NaN NaN \n", | |
"23 NaN NaN \n", | |
"24 NaN NaN \n", | |
"25 NaN NaN \n", | |
"26 0.101971 NaN \n", | |
"27 0.161454 NaN \n", | |
"28 NaN NaN \n", | |
"29 NaN NaN \n", | |
"30 NaN 0.217694 \n", | |
"31 NaN 0.085528 \n", | |
"32 NaN NaN \n", | |
"33 NaN NaN \n", | |
"34 NaN NaN \n", | |
"35 NaN NaN \n", | |
"36 NaN NaN \n", | |
"37 NaN NaN \n", | |
"38 NaN NaN \n", | |
"39 NaN NaN \n", | |
"40 NaN NaN \n", | |
"41 NaN NaN \n", | |
"42 NaN NaN \n", | |
"44 NaN NaN \n", | |
"45 NaN NaN \n", | |
"46 NaN 0.087677 \n", | |
"47 NaN NaN \n", | |
"48 NaN NaN \n", | |
"49 NaN 0.150174 \n", | |
"50 NaN NaN \n", | |
"51 NaN NaN \n", | |
"53 NaN NaN \n", | |
"54 NaN NaN \n", | |
"55 NaN NaN \n", | |
"56 NaN NaN \n", | |
"\n", | |
"[48 rows x 48 columns]" | |
] | |
}, | |
"execution_count": 46, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"# dense matrix from df\n", | |
"\n", | |
"w_midx.unstack()['weight']" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 47, | |
"id": "8469a670-6f4c-47a0-aa11-41cba39d7d4f", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"array([[nan, nan, nan, ..., nan, nan, nan],\n", | |
" [nan, nan, nan, ..., nan, nan, nan],\n", | |
" [nan, nan, nan, ..., nan, nan, nan],\n", | |
" ...,\n", | |
" [nan, nan, nan, ..., nan, nan, nan],\n", | |
" [nan, nan, nan, ..., nan, nan, nan],\n", | |
" [nan, nan, nan, ..., nan, nan, nan]])" | |
] | |
}, | |
"execution_count": 47, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"# to dense numpy\n", | |
"\n", | |
"w_midx.unstack()['weight'].to_numpy()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 48, | |
"id": "7569abd1-4dd9-4f9f-928b-5c68778012af", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"<48x48 sparse matrix of type '<class 'numpy.float64'>'\n", | |
"\twith 2304 stored elements in Compressed Sparse Row format>" | |
] | |
}, | |
"execution_count": 48, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"# to sparse\n", | |
"\n", | |
"import scipy\n", | |
"\n", | |
"scipy.sparse.csr_matrix(w_midx.unstack()['weight'].to_numpy())" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "bb800e85-906f-4d35-8850-9acbb064a824", | |
"metadata": {}, | |
"source": [ | |
"the matrix is ordered however the multiindex is sorted, so we can just stash it as an attribute to covert back and forth between sparse indices" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 49, | |
"id": "6ee7e424-b466-4ac4-af26-f95cc6017797", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Index(['01', '04', '05', '06', '08', '09', '10', '12', '13', '16', '17', '18',\n", | |
" '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30',\n", | |
" '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42',\n", | |
" '44', '45', '46', '47', '48', '49', '50', '51', '53', '54', '55', '56'],\n", | |
" dtype='object', name='focal')" | |
] | |
}, | |
"execution_count": 49, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"# these are the ordered list of keys to convert back and forth between sparse\n", | |
"\n", | |
"w_midx.unstack()['weight'].index" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "cef2ebf1-ef60-432e-8d07-10c5c75f6552", | |
"metadata": {}, | |
"source": [ | |
"I dont think we should expose this because it wont ever be necessry outside the to/from sparse functions, but if we wanted to mimic the current api" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 50, | |
"id": "1ccba8f7-fd87-406b-b5ae-6ff37124e307", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"id2i = dict(zip(w_midx.unstack()['weight'].index.tolist(), list(range(w_midx.unstack()['weight'].shape[0]))))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 51, | |
"id": "a542bae4-3aa8-4bbf-bcb9-eb767c44aac5", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"{'01': 0,\n", | |
" '04': 1,\n", | |
" '05': 2,\n", | |
" '06': 3,\n", | |
" '08': 4,\n", | |
" '09': 5,\n", | |
" '10': 6,\n", | |
" '12': 7,\n", | |
" '13': 8,\n", | |
" '16': 9,\n", | |
" '17': 10,\n", | |
" '18': 11,\n", | |
" '19': 12,\n", | |
" '20': 13,\n", | |
" '21': 14,\n", | |
" '22': 15,\n", | |
" '23': 16,\n", | |
" '24': 17,\n", | |
" '25': 18,\n", | |
" '26': 19,\n", | |
" '27': 20,\n", | |
" '28': 21,\n", | |
" '29': 22,\n", | |
" '30': 23,\n", | |
" '31': 24,\n", | |
" '32': 25,\n", | |
" '33': 26,\n", | |
" '34': 27,\n", | |
" '35': 28,\n", | |
" '36': 29,\n", | |
" '37': 30,\n", | |
" '38': 31,\n", | |
" '39': 32,\n", | |
" '40': 33,\n", | |
" '41': 34,\n", | |
" '42': 35,\n", | |
" '44': 36,\n", | |
" '45': 37,\n", | |
" '46': 38,\n", | |
" '47': 39,\n", | |
" '48': 40,\n", | |
" '49': 41,\n", | |
" '50': 42,\n", | |
" '51': 43,\n", | |
" '53': 44,\n", | |
" '54': 45,\n", | |
" '55': 46,\n", | |
" '56': 47}" | |
] | |
}, | |
"execution_count": 51, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"id2i" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "02543332-9b49-4387-83a9-246ec84bbe58", | |
"metadata": {}, | |
"source": [ | |
"Most of the rest of the internal methods rely on the sparse representation, which we can get to quickly\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 52, | |
"id": "563f9f0d-6de9-4b7c-84c2-4a59e4e78afc", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"9.114583333333334" | |
] | |
}, | |
"execution_count": 52, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"100 * scipy.sparse.csr_matrix(w_midx.unstack()['weight'].fillna(0).to_numpy()).nnz / (1.0 * 48**2)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 53, | |
"id": "a783ca6b-0eed-464a-b6c0-338b187c1fee", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"9.114583333333334" | |
] | |
}, | |
"execution_count": 53, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"w_us_rook.pct_nonzero" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "6097a72f-df90-4853-ae34-ecf93ab1214a", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "f2d18a28-cc83-41c9-a232-6962355dce0c", | |
"metadata": {}, | |
"source": [ | |
"If we handle the weights like this, it much easier to deprecate the legacy indexing stuff like `id2i`, `neighbor_offsets`, etc. that serves as our own internal indexing system. We can also easily reorder or rename neighbors easily and without any worry of getting weights values misaligned between the two separate dicts.\n", | |
"\n", | |
"when we go to do `lag_spatial` we can make sure everything that the index of the weights is in line with the index of the df (or could be reordered arbitrarily to match. Also means you can create a lag with a W created from a different dataframe, (we join on indices instead of relying on order). Makes handling missing values a lot easier\n", | |
"\n", | |
"also we can do arbitrary weights transforms as dataframe apply ops?" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "2e7380e4-19d7-45f3-af96-45fd8ea68398", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "ada800e2-8dbb-4e1a-9736-35d223e63edd", | |
"metadata": {}, | |
"source": [ | |
"Also dont think its a binary choice. We could convert here without much trouble when necessary?" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "d6a6de28-87bc-48c4-a092-38c5938c5da0", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python [conda env:libpysal]", | |
"language": "python", | |
"name": "conda-env-libpysal-py" | |
}, | |
"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.10.8" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment