Skip to main content

voting

travis rtd codecov pypi pyversions

A pure Python module for election quotas, voting measures, and apportionment methods.

Installation

The voting package works in Python 2.7, 3.5, 3.6 and 3.7. It is available on pypi and can be installed using pip.

pip install voting

Package structure

  • voting

    • apportionment

      • adams

      • dhondt

      • hagenbach_bischoff

      • hamilton

      • huntington_hill

      • jefferson

      • sainte_lague

      • vinton

      • webster

    • diversity

      • berger_parker

      • general

      • gini_simpson

      • golosov

      • inverse_simpson

      • laakso_taagepera

      • renyi

      • shannon

      • simpson

    • proportion

      • adjusted_loosemore_hanby

      • dhondt

      • gallagher

      • grofman

      • least_square

      • lijphart

      • loosemore_hanby

      • rae

      • regression

      • rose

      • sainte_lague

    • quota

      • droop

      • hagenbach_bischoff

      • hare

      • imperiali

Examples

Apportioning seats using the Huntington-Hill method.

from voting import apportionment


votes = [2560, 3315, 995, 5012]
seats = 20
assignments = apportionment.huntington_hill(votes, seats)

Calculating the effective number of parties using Golosov’s measure.

from voting import diversity


parties = [750, 150, 50, 50]
effective_parties = diversity.golosov(parties)

Measuring the disproportionality of democratic representation using the Sainte-Lague measure.

from voting import proportion


votes = [750, 150, 50, 50]
seats = [80, 16, 2, 2]
disproportionality = proportion.sainte_lague(votes, seats)

Determining the Droop quota

from voting import quota


votes = 1000
seats = 20
election_quota = quota.droop(votes, seats)

Release files for voting 0.1.3

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

Source distribution (sdist)

Source distribution for voting 0.1.3
File Size Uploaded
voting-0.1.3.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for voting 0.1.3
File Interpreter ABI Platform
voting-0.1.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 15.7 kB

Release files / voting-0.1.3.tar.gz

Download URL voting-0.1.3.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
33cd551393e32d800a713b75628570d4fce652f5e10c607cf9d29cbffa56b8cf
BLAKE2b-256 checksum
How to use checksums
83bef16c33fd38b699ddf5899fbcd0a5725fbce81808342a260a3c43421061d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

Release files / voting-0.1.3-py2.py3-none-any.whl

Download URL voting-0.1.3-py2.py3-none-any.whl
Size 8.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a9ccedf7e0732f73a8da22e457b271e36de6d2b1d12acb9daa580754988a4632
BLAKE2b-256 checksum
How to use checksums
b8854455a9ffb8cf7dd3e1e6f1da0f979f4de7054188703bb6108667ef79ea6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.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