From 87a03e44a8a384821e2a150d17374d28b8a06a4a Mon Sep 17 00:00:00 2001 From: crflynn Date: Mon, 8 Jan 2018 22:38:14 -0500 Subject: [PATCH] readme update --- README.rst | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/README.rst b/README.rst index 1662fec..3d2fda3 100644 --- a/README.rst +++ b/README.rst @@ -3,3 +3,112 @@ voting A pure Python module for election quotas, voting measures, and apportionment methods. + +Installation +------------ + +The ``voting`` package works in Python 2.7, 3.4, 3.5, 3.6. 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 + * 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)