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
```
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
Release history Release notifications | RSS feed
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 details)
Built Distribution
File details
Details for the file pandas-redistrict-0.0.1.tar.gz
.
File metadata
- Download URL: pandas-redistrict-0.0.1.tar.gz
- Upload date:
- Size: 39.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c1252838ef38bfe76a65ef095db953e9228bb10d4f16689a90933bee49e8f75 |
|
MD5 | b632ade9e9afc3ac0203c22601894ea2 |
|
BLAKE2b-256 | fe36bbaff60f6c83eecec6311f1c3fb27c2e3142c8d2073f735908a0cf06b350 |
File details
Details for the file pandas_redistrict-0.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: pandas_redistrict-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 40.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d86a637fe764b6160e7a88e9405130fbcd6b663da6c0e341a3ddb16e1ac6fe20 |
|
MD5 | 990cf8bf823cb9a9e2ba3f7c99d133ed |
|
BLAKE2b-256 | 00bf00d1532eb252085ec0fa6bdd28b25033a7a26fb0f59062e1f09c94c711c8 |