Search

Quickstart

the Community class is geosnap’s central data construct that holds space-time neighborhood data.
You can create a Community from geosnap’s built-in data by passing a set of fips codes to a constructor method

from geosnap.data import Community
dc = Community.from_census(state_fips='11')

Using the .from_census constructor, you’ll get 30 years of census tract data in their original boundaries with over a hundred commonly used demographic and socioeconomic variables. Data are stored as a long-form geodataframe under the gdf attribute

dc.gdf.head()
geoid geometry median_contract_rent median_home_value median_household_income median_income_asianhh median_income_blackhh median_income_hispanichh median_income_whitehh n_age_5_older ... p_unemployment_rate p_vacant_housing_units p_veterans p_vietnamese_persons p_white_over_60 p_white_over_65 p_white_under_15 p_widowed_divorced per_capita_income year
53214 11001001600 POLYGON ((-77.02680206298828 38.98410034179688... 477.0 285100.0 75252.0 NaN NaN NaN NaN 4.742191e+70 ... 0.0 2.58 1.028308e+08 0.00 3.159920e+25 4.999423e+17 1.378187e+24 0.0 32166.0 1990
53215 11001001500 POLYGON ((-77.05280303955078 38.98649978637695... 1001.0 366000.0 79681.0 NaN NaN NaN NaN 1.025723e+72 ... 0.0 3.38 7.095389e+07 0.23 6.529311e+30 1.483617e+23 6.816417e+33 0.0 36452.0 1990
53216 11001001701 POLYGON ((-77.02660369873047 38.97769927978516... 429.0 135600.0 34420.0 NaN NaN NaN NaN 6.918716e+64 ... 0.0 3.89 8.990532e+05 0.10 1.184601e+14 1.285720e+10 8.476736e+15 0.0 17782.0 1990
53217 11001001801 POLYGON ((-77.02660369873047 38.97769927978516... 1001.0 0.0 77197.0 NaN NaN NaN NaN 3.084115e+31 ... 0.0 10.00 5.229000e+01 0.00 1.450982e+11 1.437909e+08 1.321830e+14 0.0 14679.0 1990
53218 11001001702 POLYGON ((-77.00859832763672 38.97000122070312... 514.0 129300.0 42661.0 NaN NaN NaN NaN 4.210494e+62 ... 0.0 3.96 7.219278e+04 0.04 4.438992e+13 2.147213e+10 2.352939e+17 0.0 20468.0 1990

5 rows × 195 columns

you can create a geodemographic typology using classic clustering methods on the Community

dc = dc.cluster(method='kmeans', n_clusters=6, columns=['p_unemployment_rate', 'per_capita_income'] )
dc.gdf[dc.gdf.year==2000].plot(column='kmeans')

you can create a regionalization using spatially-constrained clustering methods on the Community

dc = dc.cluster_spatial(method='spenc', n_clusters=6, columns=['p_unemployment_rate', 'per_capita_income'] )
dc.gdf[dc.gdf.year==2000].plot('spenc')

You can also harmonize Community boundaries so that they’re consistent over time. For example

dc = dc.harmonize(2010, extensive_variables=["population"])

will create a new Community with population in 1990 and 2000 modeled as 2010 tract boundaries (2010 will remain unchanged). Thanks to tobler, geosnap provides several methods for harmonization, from simple areal interpolation to model-based approaches using auxiliary data. See the harmonization example for more code samples

You can explore datasets using a prototype interactive dashboard using

from geosnap.vizualize import explore
explore()

By default, the dashboard will launch with built-in census data, but if you've stored other databases, then you can exlore those as well.

Many more visualization features coming soon