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/GeoCalista/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.

Contributing

See CONTRIBUTING.md for how the code is laid out, how to run the tests and how a change gets in, and RULINGS.md for the method decisions the code must keep.

License

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

Metadata

Release files for equipop 1.64.2

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.64.2
File Size Uploaded Provenance Actions
equipop-1.64.2.tar.gz 5.7 MB With provenance Details for equipop-1.64.2.tar.gz

Built distribution (wheel)

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

Total release size: 8.5 MB

Release files / equipop-1.64.2.tar.gz

Download URL equipop-1.64.2.tar.gz
Size 5.7 MB
Tags Source
SHA-256 checksum
How to use checksums
ca8396a1fc938c0b1e37d0c9b4ee4e0a00df497312973fc43a21ea3e8c7e89bb
BLAKE2b-256 checksum
How to use checksums
89e8fc8cc2c655030fe82ba32e06edd460841ed5110e72f26c9811425aca3b35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

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

Download URL equipop-1.64.2-py3-none-any.whl
Size 2.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
af5389510b1b277910d1614c8a0e0b7fea759c6028ec3c5f443ed82b3cfebee2
BLAKE2b-256 checksum
How to use checksums
e8a3a166448e5dd6502f20f6d1df3c6141d6354a1436523f1905af32b76ead6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for equipop 1.64.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for equipop-1.64.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.64.2 This release

2 release files Full provenance

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