Pref Grade Profiles

Profiles of voters that each submit both a (truncated) strict weak order and an assignment of grades from a fixed set to each candidate. The ballots for a PrefGradeProfile are Rankings and Grades.

PrefGradeProfile Class

class pref_voting.pref_grade_profile.PrefGradeProfile(rankings, grade_maps, grades, rcounts=None, candidates=None, cmap=None, gmap=None, grade_order=None)[source]

An anonymous profile in which each voter submits both a (truncated) strict weak order and an assignment of grades. See the module docstring for the design.

Parameters:
  • rankings – List of rankings (each a Ranking or a dict).

  • grade_maps – List of grade maps (each a Grade or a dict).

  • grades – List of grades.

  • rcounts – Number of voters for each ranking/grade pair.

  • candidates – List of candidates (defaults to the union appearing in the data).

  • cmap – candidate-name map.

  • gmap – grade-name map.

  • grade_order – grades from largest to smallest (numeric > if None).

anonymize()[source]

Group identical (ranking, grade) ballots together.

description()[source]

Return the Python code needed to create the profile.

display(cmap=None, style='pretty', curr_cands=None, show_grades=True, show_totals=False)[source]

Display the ranking table and (optionally) the grade table.

remove_candidates(cands_to_ignore)[source]

Remove cands_to_ignore from both the rankings and the grades.

remove_empty_rankings()[source]

Remove ballots whose ranking is empty, keeping grades in lockstep.

to_grade_profile()[source]

Return a GradeProfile of just the grade side.

to_ranking_profile()[source]

Return a ProfileWithTies of just the ranking side.