Skip to main content

Redistricting of district-indexed tables

Project description

# pandas-redistrict

Uses data on redistricting to apply redistricting to older datasets to represent the districts in their current state.

Supports merging and splitting of districts:
- Merged districts are summed up under new identifier
- Split districts are distributed by population-based ratio.

Data on redistricting is in `data/` directory. Currently only available for German *Kreise* (containing reforms in NRW, Sachsen, Sachsen-Anhalt and Mecklenburg-Vorpommern).


``` python
>>> df # Values of indexed by German district identifiers
value1 value2
AGS
05354 4 5
05313 5 6
05334 6 7
15154 8 9
15159 10 11
15151 12 13
15082 13 14

>>> # Port old identifiers to new versions. Sum and distribute values on the way
>>> from redistrict import redistrict
>>> redistrict(df, 'de/kreise', drop=True, splits=True)
value1 value2
AGS
05334 15.00 18.00
15001 2.40 2.60
15082 35.44 38.81
15086 0.96 1.04
15091 4.20 4.55
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pandas-redistrict-0.0.1.tar.gz (39.7 kB view hashes)

Uploaded Source

Built Distribution

pandas_redistrict-0.0.1-py2.py3-none-any.whl (40.8 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page