This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
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).

Install like this:

pip install pandas-redistrict


## Usage

``` python
>>> df # Values 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
```

When you want to preserve groups inside districts, you can use ``redistrict_grouped``:

``` python
>>> # Specify district column (e.g. AGS)
>>> # Also specify groups to preserve, in this case year
>>> df
AGS year value1 value2
0 05354 2008 4 5
1 05313 2008 5 6
2 05334 2011 6 7
3 15154 2005 8 9
4 15159 2005 10 11
5 15151 2005 12 13
6 15082 2013 13 14
>>> from redistrict import redistrict_grouped
redistrict_grouped(df, 'de/kreise', ['year'],
district_col='AGS',
value_cols=['value1', 'value2'],
drop=True)

AGS value1 value2 year
0 15001 2.40 2.60 2005
1 15082 22.44 24.81 2005
2 15086 0.96 1.04 2005
3 15091 4.20 4.55 2005
0 05334 9.00 11.00 2008
0 05334 6.00 7.00 2011
0 15082 13.00 14.00 2013
```
Release History

Release History

0.0.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pandas_redistrict-0.0.3-py2.py3-none-any.whl (43.2 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Sep 8, 2015
pandas-redistrict-0.0.3.tar.gz (41.9 kB) Copy SHA256 Checksum SHA256 Source Sep 8, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting