segregation
Analytics for spatial and non-spatial segregation in Python.
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has no known vulnerabilities, and fills a specialized but well-defined niche in spatial demographic analysis. Low install friction and a permissive license make adoption straightforward. Install it if you need to compute segregation indices or test segregation hypotheses; skip it if your work does not involve demographic or residential segregation measurement.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.12 or later.
- For spatial indices, input must be a geopandas.GeoDataFrame with a geometry column.
- Low friction installation with a pure-Python wheel.
License · maintenance · safety
BSD 3-Clause (permissive) — BSD 3-Clause permissive license allows commercial and private use with minimal restrictions; you must retain the license and copyright notice.
last release 2026-06-18 (57 days) · last repo commit 2026-08-07 · 121 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 150,740 downloads/mo, #10,956 on PyPI
Alternatives
Verify before relying
pip install segregation
from segregation.aspatial import Dissim
import pandas as pd
df = pd.DataFrame({"group_pop": ["values"], "total_pop": ["values"]})
index = Dissim(df, "group_pop", "total_pop")
print(index.statistic)- Whether all 40+ segregation measures are equally well-maintained and documented.
- Performance characteristics when working with large datasets or many spatial weights matrices.
- Whether the package supports integration with external spatial network objects beyond PySAL weights.
What it is and what it does
Segregation is a PySAL package for quantifying and analyzing patterns of urban segregation using demographic data. It implements a large suite of segregation indices—ranging from classic measures like dissimilarity and isolation to modern spatial variants—and wraps them as classes that accept a pandas or geopandas DataFrame, a group-of-interest column, and a total-population column to produce point estimates. Beyond calculation, the package provides statistical inference (testing whether estimates are significant or comparing two estimates) and decomposition (breaking differences into spatial-structure and demographic-structure components).
The package is built on a stack of geospatial and scientific Python libraries: geopandas for geometry handling, scikit-learn and scipy for statistical methods, numba for numerical acceleration, and joblib for parallelization. It targets researchers and practitioners analyzing residential patterns, income distribution, or other demographic segregation in urban areas. Spatial indices can use PySAL weights matrices, Euclidean distances, or topological relationships, giving users fine control over how distance and adjacency are defined.
Use it for
- Calculate dissimilarity or isolation indices to measure how evenly a demographic group is distributed across neighborhoods.
- Compare segregation levels between two cities or time periods using inference tests to determine statistical significance.
- Decompose changes in segregation into components driven by shifts in spatial structure versus demographic composition.
- Compute local segregation indices to identify neighborhoods with high or low segregation relative to the city overall.
- Analyze segregation using multiscalar definitions or distance-decay models to understand patterns at different geographic scales.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has no known vulnerabilities, and fills a specialized but well-defined niche in spatial demographic analysis. Low install friction and a permissive license make adoption straightforward. Install it if you need to compute segregation indices or test segregation hypotheses; skip it if your work does not involve demographic or residential segregation measurement.
Install
segregation on PyPI
Before you install
Low friction installation with a pure-Python wheel. Active maintenance—last commit 2026-08-07, released 2026-06-18. Requires Python 3.12 or later. Pulls in 13 runtime dependencies including geopandas, scikit-learn, and scipy, which may add setup time in constrained environments.
Requires Python 3.12 or later. For spatial indices, input must be a geopandas.GeoDataFrame with a geometry column.
License in practice
BSD 3-Clause permissive license allows commercial and private use with minimal restrictions; you must retain the license and copyright notice.
Quickstart
pip install segregation
from segregation.aspatial import Dissim
import pandas as pd
df = pd.DataFrame({"group_pop": ["values"], "total_pop": ["values"]})
index = Dissim(df, "group_pop", "total_pop")
print(index.statistic)
Verify before relying
- Whether all 40+ segregation measures are equally well-maintained and documented.
- Performance characteristics when working with large datasets or many spatial weights matrices.
- Whether the package supports integration with external spatial network objects beyond PySAL weights.
Package facts
| License | BSD 3-Clause permissive |
| Python support | Supports the current Python release >=3.12 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 13 packagesgeopandasjobliblibpysalmapclassifymatplotlibnumbanumpypandaspyprojscikit-learnscipyseaborntqdm |
| Maintenance | Actively maintained 57 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 150,740 / month, #10,956 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: Scientific/Engineering :: GIS |
Evidence: segregation-2.5.5-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “segregation indices calculation”
- segregationCalculates over 40 segregation indices—both aspatial and spatial—to…
- py-lets-be-rationalComputes implied volatility from option prices using Peter Jaeckel's…
- pysalPySAL is a meta-package that bundles 29 spatial analysis libraries…
Give your agent the search over MCP, or paste the wish link into any chat.
More GIS packages
Shapely provides Python tools for creating, manipulating, and analyzing 2D geometric objects (points, lines, polygons) using the GEOS library, with both scalar and vectorized NumPy-based operations.
pyproj provides a Python interface to PROJ, enabling cartographic projections and coordinate system transformations for geospatial applications.
GeoPandas extends pandas DataFrames to handle geographic data, combining pandas operations with shapely geometry and spatial analysis capabilities that would otherwise require a spatial database.
Install it if you work with geographic data in Python and want to avoid setting up a spatial database or learning a separate GIS tool.
geopy is a Python client for geocoding and distance calculation that converts addresses to coordinates and vice versa using multiple web-based geocoding services, and computes geodesic and great-circle distances between geographic points.
Install it if you need geocoding or distance calculations in your application.
Pyogrio provides fast, bulk-oriented read and write access to vector spatial data formats (Shapefile, GeoPackage, GeoJSON, etc.) via GDAL/OGR bindings, typically for use with GeoPandas GeoDataFrames.
h3 provides Python bindings to Uber's H3 geospatial indexing library, converting geographic coordinates into hierarchical hexagonal grid cells and performing spatial operations on them.
See also pysal · inequality · krippendorff · access · esda · spatial-access · momepy · libpysal · pointpats · cityseer