Skip to main content

EquiPop (Python)

k-nearest neighbour contexts/neighbourhoods on gridded and hexagonal data: bespoke neighbourhoods, friction-aware growth, distance decay, neighbourhood statistics and segregation measures - for very large datasets.

EquiPop finds, for every populated location, the k nearest individuals (by cumulative population count, expanding over a uniform grid) and reports the composition of that individualised neighbourhood. The gridded design means one pre-computed distance ordering serves every origin, which is what makes millions of locations feasible.

The EquiPop family

This is the first Python implementation. Its relatives: the original C# EquiPop (three generations, two public releases; radial and Flow models, downloadable via Uppsala University) and an R version covering I/O and the basic k-NN parts. This Python version additionally carries friction growth, five decay models, exact neighbourhood statistics (mean/median/SD/SE/Gini/entropy), segregation indices, hexagonal grids, area aggregation and metadata logging.

Install

pip install equipop            # core
pip install equipop[geo,io,viz]  # shapefiles/rasters, Excel/SPSS, maps

Quick start

import pandas as pd
from equipop import build_cells, run_knn_stats

df = pd.read_csv("individuals.csv")        # one row per individual
cd = build_cells(df, e_col="X", n_col="Y",
                 binary_vars=["treated"], value_vars=["income"],
                 unit_size=100)
res = run_knn_stats(cd, k_values=[100, 400, 1600, 6400],
                    stats={"treated": ["ratio"],
                           "income": ["mean", "median", "gini"]})

For aggregated counts at national scale use the vectorised run_knn_counts; for friction-constrained growth run_knn_friction; for segregation profiles seg_profile; for policy-area reporting aggregate_output; for quick maps map_output. See MANUAL_TOPICS.md.

Repository: https://github.com/GeoJohnSwe/EquiPop

Citing

Please cite the software and the methods you use - see CITATION.cff. Core reference: Östh (2014), Introducing the EquiPop software, Uppsala University. Segregation measures: Östh, Clark & Malmberg (2015), Geographical Analysis 47(1). Decay parameters: Östh, Lyhagen & Reggiani (2016), EJTIR 16(2). Friction growth: Östh & Türk (2020), Handbook of Urban Segregation. Decay profiles in application: Türk, Östh, Kourtit & Nijkamp (2026), Journal of Urban Mobility 9.

License

MIT. Attribution through citation is warmly requested (see above).

Release files for equipop 1.16.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for equipop 1.16.1
File Size Uploaded
equipop-1.16.1.tar.gz 95.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for equipop 1.16.1
File Interpreter ABI Platform
equipop-1.16.1-py3-none-any.whl Python 3 none any Details

Total release size: 173.8 kB

Release files / equipop-1.16.1.tar.gz

Download URL equipop-1.16.1.tar.gz
Size 95.0 kB
Tags Source
SHA-256 checksum
How to use checksums
25462c9fba687e68bce1ef12cbf909e7ce0aaede294984f22cff6841e65371aa
BLAKE2b-256 checksum
How to use checksums
da7e07c8d6d552c51e636f14e937f8e8dbae9d87428bcb2db4133a9c366589bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / equipop-1.16.1-py3-none-any.whl

Download URL equipop-1.16.1-py3-none-any.whl
Size 78.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
799a071378e466e586e1295a5918581466cb6a1b821b2c2569b47c54cd7b1b9b
BLAKE2b-256 checksum
How to use checksums
3bc45f0ddf5654c3c5817db3416bc8b2dda4933685f93dd0ea52cb80a54ffc7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release history Release notifications | RSS feed

1.48.0

2 release files

1.47.7

2 release files

1.47.6

2 release files

1.47.4

2 release files

1.47.3

2 release files

1.47.2

2 release files

1.47.1

2 release files

1.47.0

2 release files

1.43.4

2 release files

1.43.3

2 release files

1.43.1

2 release files

1.43.0

2 release files

1.42.0

2 release files

1.41.2

2 release files

1.41.1

2 release files

1.41.0

2 release files

1.40.7

2 release files

1.40.6

2 release files

1.40.5

2 release files

1.40.4

2 release files

1.40.3

2 release files

1.40.1

2 release files

1.36

2 release files

1.35.1

2 release files

1.35

2 release files

1.34

2 release files

1.31

2 release files

1.30.2

2 release files

1.30.1

2 release files

1.30

2 release files

1.29.9

2 release files

1.29.8

2 release files

1.29.6

2 release files

1.19.0

2 release files

1.18.1

2 release files

1.17.3

2 release files

1.17.2

2 release files

1.17.1

2 release files

1.17.0

2 release files

1.16.8

2 release files

1.16.7

2 release files

1.16.6

2 release files

1.16.5

2 release files

1.16.4

2 release files

1.16.3

2 release files

1.16.2

2 release files

This release

1.16.1 This release

2 release files

1.16.0

2 release files

1.15.0

2 release files

1.14.1

2 release files

1.14.0

2 release files

1.13.0

2 release files

1.12.0

2 release files

1.11.0

2 release files

1.10.0

2 release files

1.9.1

2 release files

1.8.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.1

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page