Skip to content
A Python implementation of common apportionment methods
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

A Python implementation of common apportionment methods

This is a collection of common apportionment methods. Apportionment has two main applications: to assign a fixed number of parliamentary seats to parties (proportionally to their vote count), and to assign representatives in a senate to states (proportionally to their population count). A recommendable overview of apportionment methods can be found in the book "Fair Representation" by Balinski and Young [2].

The following apportionment methods are implemented:

  • the largest remainder method (or Hamilton method)
  • the class of divisor methods including
    • D'Hondt (or Jefferson)
    • Sainte-Laguë (or Webster)
    • Huntington-Hill
    • Adams
  • the quota method [1]


The following example calculates the seat distribution of Austrian representatives in the European Parliament based on the D'Hondt method and the 2019 election results. Parties that received less than 4% are excluded from obtaining seats and are thus excluded in the calculation.

import apportionment
parties = ['ÖVP','SPÖ','FPÖ','GRÜNE','NEOS']
distribution = [ 1305956, 903151, 650114, 532193, 319024]
apportionment.method("dhondt", distribution, seats, parties, verbose=True)

Another example can be found in


[1] Balinski, M. L., & Young, H. P. (1975). The quota method of apportionment. The American Mathematical Monthly, 82(7), 701-730.

[2] Balinski, M. L., & Young, H. P. (1982). Fair Representation: Meeting the Ideal of One Man, One Vote. Yale University Press, 1982. (There is a second edition from 2001 by Brookings Institution Press.)

You can’t perform that action at this time.