Wybory - przeliczanie głosów. A pure Python module for election quotas, voting measures, and apportionment methods.
 
 
Go to file
dependabot[bot] e768ff8c70
Bump jinja2 from 2.10.3 to 2.11.3
Bumps [jinja2](https://github.com/pallets/jinja) from 2.10.3 to 2.11.3.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/master/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/2.10.3...2.11.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-19 21:33:03 +00:00
docs rtd.yml 2019-07-11 23:27:59 -04:00
tests Webster fix (#9) 2019-10-13 22:13:32 -04:00
voting bump to v0.1.3 (#10) 2019-10-13 22:19:18 -04:00
.gitignore pytest/black compatibility changes 2019-07-11 20:54:03 -04:00
.readthedocs.yml rtd.yml 2019-07-11 23:27:59 -04:00
.travis.yml Add support for Python 3.8 (#11) 2019-12-23 17:40:50 -05:00
HISTORY.rst bump to v0.1.3 (#10) 2019-10-13 22:19:18 -04:00
LICENSE.txt bump version to 0.1.2 2019-07-11 22:11:07 -04:00
README.rst bump to v0.1.3 (#10) 2019-10-13 22:19:18 -04:00
deploy.sh bump to v0.1.3 (#10) 2019-10-13 22:19:18 -04:00
poetry.lock Bump jinja2 from 2.10.3 to 2.11.3 2021-03-19 21:33:03 +00:00
pyproject.toml Add support for Python 3.8 (#11) 2019-12-23 17:40:50 -05:00
pytest.ini tests 2018-01-08 22:12:31 -05:00

README.rst

voting
======

|travis| |rtd| |codecov| |pypi| |pyversions|


.. |travis| image:: https://img.shields.io/travis/crflynn/voting.svg
    :target: https://travis-ci.org/crflynn/voting

.. |rtd| image:: https://img.shields.io/readthedocs/voting.svg
    :target: http://voting.readthedocs.io/en/latest/

.. |codecov| image:: https://codecov.io/gh/crflynn/voting/branch/master/graphs/badge.svg
    :target: https://codecov.io/gh/crflynn/voting

.. |pypi| image:: https://img.shields.io/pypi/v/voting.svg
    :target: https://pypi.python.org/pypi/voting

.. |pyversions| image:: https://img.shields.io/pypi/pyversions/voting.svg
    :target: https://pypi.python.org/pypi/voting


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.

.. code-block:: shell

    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.

.. code-block:: python

    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.

.. code-block:: python

    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.

.. code-block:: python

    from voting import proportion


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

Determining the Droop quota

.. code-block:: python

    from voting import quota


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