Skip to content

Equal-Vote/starpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

starpy

Python implementation of the STAR Voting system.

Getting started

Install the required packages

pip install .

Usage

Single winner STAR

To run a single winner election create a pandas dataframe of the ballot data and pass it into the STAR function

from starpy.STAR import STAR
import pandas as pd
ballots = pd.DataFrame(columns=['Allie', 'Billy', 'Candace'],
                       data=[*2*[[5,      4,       0]],
                             *1*[[2,      5,       1]],
                             *2*[[0,      4,       5]],])
results = STAR(ballots)
print(results['elected'])

Multi-winner Bloc STAR

To run a multi-winner bloc STAR race, set the input parameter numwinners

results = STAR(ballots, numwinners=2)

Multi-winner Proportional STAR

To run proportional STAR

from starpy.Allocated_Score import Allocated_Score 
import pandas as pd
numwinners=2
ballots = pd.DataFrame(columns=['Allie', 'Billy', 'Candace'],
                       data=[*2*[[5,      4,       0]],
                             *1*[[2,      5,       1]],
                             *2*[[0,      4,       5]],])

winner_list = Allocated_Score(5, numwinners, ballots)
print(winner_list)

About

Python implementation of the STAR Voting system

Topics

Resources

License

Stars

Watchers

Forks

Contributors 9

Languages