Skip to content

Latest commit

 

History

History

Chicago_scripts

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

rcv

Build Status Code Coverage Documentation Status PyPI Package

rcv is a Python library for tabulating ballots from ranked-choice elections. The package is distributed under the BSD 3-Clause License.

Examples

from rcv import FractionalSTV, PreferenceSchedule

schedule = PreferenceSchedule.from_ballots([
    ("A", "B", "C"),
    ("A", "C", "B"),
    ("A", "C", "B"),
])

stv = FractionalSTV(schedule, seats=2)
winners = stv.elect()

assert winners == {"A", "C"}