- class svvamp.ProfileFromFile(file_name, sort_candidates=False, sort_voters=False)[source]#
Profile from a file.
- Parameters:
Notes
If the file name ends with ‘.cvr.csv’ (cvr = Cast Vote Records): first row gives the column headers. The last headers are ‘rank1’, ‘rank2’, etc. Each row represents a voter. In the column ‘rank1’, the name of her most-liked candidate, etc.
If the file name ends with ‘.t.csv’ (t = transposed format): simple table of utilities with candidates declared in the first column and voters declared in the first row.
If the file name ends with ‘.csv’ (but not ‘.t.csv’), candidates must be declared in the first row and voters in the first column.
Otherwise, the file is considered as a PrefLib file.
For CVR and PrefLib files, since the information is ordinal only,
preferences_ut[v, c]
is set to the Borda score (with no vtb) minus(C - 1) / 2
. This way, utilities are between- (C - 1) / 2
and(C - 1) / 2
.