I'm looking at the results of the 2015 UK general election
ukp2015raw = Import["http://researchbriefings.files.parliament.uk/documents/CBP-7186/hocl-ge2015-results-full.csv", "CSV"];
Which I choose to store as a
ukp2015 = Dataset@Map[AssociationThread[ukp2015raw[] -> #] &, ukp2015raw[[2 ;;]]];
Which gives the correct answer. But, I would have expected the same output from
ukp2015[GroupBy["constituency_name"], MaximalBy[#, "votes"] &]
Why do I get a different answer from the later?
(Using Mathematica 18.104.22.168 on Windows 7 Pro SP1 64 bits)
Ultimately I would want to select all constituencies where party X won, but party Y or Z would have won if Y and Z selectively dropped candidates and a given percentage of votes are inherited. The thing is that the
Select statements get complicated by the fact that
MaximalBy[#, "votes"] & doesn't give me the expected output.