Skip to content

Commit b9c3617

Browse files
committed
fix ranking display
correctly compute existing_ranks as a list for ranking display.
1 parent 6844a0a commit b9c3617

File tree

5 files changed

+69
-48
lines changed

5 files changed

+69
-48
lines changed

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
author = 'Wes Holliday and Eric Pacuit'
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = '1.16.25'
25+
release = '1.16.26'
2626
html_extra_path = ['../../axiom_tables']
2727

2828

example.ipynb

Lines changed: 65 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 6,
5+
"execution_count": 1,
66
"id": "4a8a73a7",
77
"metadata": {},
88
"outputs": [],
@@ -22,58 +22,79 @@
2222
},
2323
{
2424
"cell_type": "code",
25-
"execution_count": 8,
25+
"execution_count": 2,
26+
"id": "67136702",
27+
"metadata": {},
28+
"outputs": [
29+
{
30+
"data": {
31+
"text/plain": [
32+
"[0, 1, 2, 3, 4, 5]"
33+
]
34+
},
35+
"execution_count": 2,
36+
"metadata": {},
37+
"output_type": "execute_result"
38+
}
39+
],
40+
"source": [
41+
"list(range(0,6))"
42+
]
43+
},
44+
{
45+
"cell_type": "code",
46+
"execution_count": 3,
2647
"id": "2a2a4a26",
2748
"metadata": {},
2849
"outputs": [
2950
{
3051
"name": "stdout",
3152
"output_type": "stream",
3253
"text": [
33-
"+---+---+---+---+\n",
34-
"| 2 | 3 | 2 | 3 |\n",
35-
"+---+---+---+---+\n",
36-
"| 0 | 1 | 0 | 2 |\n",
37-
"| 1 | 0 | 2 | 0 |\n",
38-
"| 2 | 2 | 1 | 1 |\n",
39-
"+---+---+---+---+\n",
40-
"+---+---+---+---+\n",
41-
"| 3 | 3 | 2 | 2 |\n",
42-
"+---+---+---+---+\n",
43-
"| 1 | 2 | 0 | 0 |\n",
44-
"| 0 | 0 | 1 | 2 |\n",
45-
"| 2 | 1 | 2 | 1 |\n",
46-
"+---+---+---+---+\n",
47-
"+---+---+---+---+\n",
48-
"| 2 | 3 | 2 | 3 |\n",
49-
"+---+---+---+---+\n",
50-
"| 0 | 1 | 0 | 2 |\n",
51-
"| 1 | 0 | 2 | 0 |\n",
52-
"| 2 | 2 | 1 | 1 |\n",
53-
"+---+---+---+---+\n",
54+
"+---+---+---+---+---+\n",
55+
"| 3 | 2 | 2 | 2 | 1 |\n",
56+
"+---+---+---+---+---+\n",
57+
"| 2 | 1 | 0 | 1 | 0 |\n",
58+
"| 1 | 2 | 1 | 0 | 2 |\n",
59+
"| 0 | 0 | 2 | 2 | 1 |\n",
60+
"+---+---+---+---+---+\n",
61+
"+---+---+---+---+---+\n",
62+
"| 3 | 2 | 2 | 2 | 1 |\n",
63+
"+---+---+---+---+---+\n",
64+
"| 2 | 1 | 0 | 1 | 0 |\n",
65+
"| 1 | 2 | 1 | 0 | 2 |\n",
66+
"| 0 | 0 | 2 | 2 | 1 |\n",
67+
"+---+---+---+---+---+\n",
68+
"+---+---+---+---+---+\n",
69+
"| 3 | 2 | 2 | 2 | 1 |\n",
70+
"+---+---+---+---+---+\n",
71+
"| 2 | 1 | 0 | 1 | 0 |\n",
72+
"| 1 | 2 | 1 | 0 | 2 |\n",
73+
"| 0 | 0 | 2 | 2 | 1 |\n",
74+
"+---+---+---+---+---+\n",
5475
"\n",
5576
"\n",
56-
"+---+---+---+---+\n",
57-
"| 2 | 3 | 2 | 3 |\n",
58-
"+---+---+---+---+\n",
59-
"| 0 | 1 | 0 | 2 |\n",
60-
"| 1 | 0 | 2 | 0 |\n",
61-
"| 2 | 2 | 1 | 1 |\n",
62-
"+---+---+---+---+\n",
63-
"+---+---+---+---+\n",
64-
"| 3 | 3 | 2 | 2 |\n",
65-
"+---+---+---+---+\n",
66-
"| 1 | 2 | 0 | 0 |\n",
67-
"| 0 | 0 | 1 | 2 |\n",
68-
"| 2 | 1 | 2 | 1 |\n",
69-
"+---+---+---+---+\n",
70-
"+---+---+---+---+\n",
71-
"| 2 | 3 | 2 | 3 |\n",
72-
"+---+---+---+---+\n",
73-
"| 0 | 1 | 0 | 2 |\n",
74-
"| 1 | 0 | 2 | 0 |\n",
75-
"| 2 | 2 | 1 | 1 |\n",
76-
"+---+---+---+---+\n"
77+
"+---+---+---+---+---+\n",
78+
"| 3 | 2 | 2 | 2 | 1 |\n",
79+
"+---+---+---+---+---+\n",
80+
"| 2 | 1 | 0 | 1 | 0 |\n",
81+
"| 1 | 2 | 1 | 0 | 2 |\n",
82+
"| 0 | 0 | 2 | 2 | 1 |\n",
83+
"+---+---+---+---+---+\n",
84+
"+---+---+---+---+---+\n",
85+
"| 3 | 2 | 2 | 2 | 1 |\n",
86+
"+---+---+---+---+---+\n",
87+
"| 2 | 1 | 0 | 1 | 0 |\n",
88+
"| 1 | 2 | 1 | 0 | 2 |\n",
89+
"| 0 | 0 | 2 | 2 | 1 |\n",
90+
"+---+---+---+---+---+\n",
91+
"+---+---+---+---+---+\n",
92+
"| 3 | 2 | 2 | 2 | 1 |\n",
93+
"+---+---+---+---+---+\n",
94+
"| 2 | 1 | 0 | 1 | 0 |\n",
95+
"| 1 | 2 | 1 | 0 | 2 |\n",
96+
"| 0 | 0 | 2 | 2 | 1 |\n",
97+
"+---+---+---+---+---+\n"
7798
]
7899
}
79100
],

pref_voting/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.16.25'
1+
__version__ = '1.16.26'

pref_voting/profiles_with_ties.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ def display(
841841
curr_cands = curr_cands if curr_cands is not None else self.candidates
842842
cmap = cmap if cmap is not None else self.cmap
843843

844-
existing_ranks = max(max(r.ranks) for r in _rankings) if len(_rankings) > 0 else 0
844+
existing_ranks = list(range(min(min(r.ranks) for r in _rankings), max(max(r.ranks) for r in _rankings) + 1)) if len(_rankings) > 0 else []
845845
if order_by_counts:
846846
_rankings, rcounts = zip(*sorted(zip(_rankings, self.rcounts), key=lambda x: x[1], reverse=True))
847847
else:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[tool.poetry]
99
name = "pref_voting"
10-
version = "1.16.25"
10+
version = "1.16.26"
1111
description = "pref_voting is a Python package that contains tools to reason about elections and margin graphs, and implementations of voting methods."
1212
authors = ["Eric Pacuit <[email protected]>"]
1313
license = "MIT"

0 commit comments

Comments
 (0)