import contextily as ctximport geopandas as gpdimport matplotlib.pyplot as pltfrom geosnap import DataStorefrom geosnap import analyze as gazfrom geosnap import io as giofrom geosnap import visualize as gvzfrom IPython.display import Image%load_ext watermark%watermark -a 'eli knaap'-iv -d -u
OMP: Info #276: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.
Author: eli knaap
Last updated: 2025-04-08
matplotlib: 3.10.0
IPython : 8.31.0
geopandas : 1.0.1
contextily: 1.6.2
geosnap : 0.14.1.dev14+g0443e2a.d20250103
As with geodemographic clustering, when carrying out a regionalization exercise, we are searching for groups of observations (census tracts in this case) which are similar in socioeconomic and demographic composition. If the goal of geodemographics is to identify neighborhood types, that could exist anywhere in the region, the goal of regionalization is to identify specific neighborhoods that exist at a distinct place in the region
Following that concept, we can use constrained clustering to develop an empirical version of geographically-bounded neighborhoods, where the neighborhoods are defined by internal social homogeneity. This is similar to the historic and well-defined neighborhood zones in places like Chicago and Pittsburgh.
/Users/knaaptime/Dropbox/projects/geosnap/geosnap/io/util.py:273: UserWarning: Unable to find local adjustment year for 2021. Attempting from online data
warn(
/Users/knaaptime/Dropbox/projects/geosnap/geosnap/io/constructors.py:217: UserWarning: Currency columns unavailable at this resolution; not adjusting for inflation
warn(
/Users/knaaptime/Dropbox/projects/geosnap/geosnap/analyze/geodemo.py:406: FutureWarning: `use_index` defaults to False but will default to True in future. Set True/False directly to control this behavior and silence this warning
w0 = W.from_dataframe(df, **weights_kwargs)
/Users/knaaptime/miniforge3/envs/urban_analysis/lib/python3.12/site-packages/libpysal/weights/contiguity.py:347: UserWarning: The weights matrix is not fully connected:
There are 4 disconnected components.
There are 2 islands with ids: 568, 1944.
W.__init__(self, neighbors, ids=ids, **kw)
/Users/knaaptime/Dropbox/projects/geosnap/geosnap/analyze/geodemo.py:429: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas. Value '['4' '4' '4' ... nan nan nan]' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.
gdf.update(clusters)
Make this Notebook Trusted to load map: File -> Trust Notebook