As part of The Globe’s new series “Reinventing Parliament,” we
decided to investigate how often Members of Parliament voted
against the majority of their party. The undertaking took weeks
of number crunching, programming and visualizing to put
together. The end product shows a clear trend: MPs rarely break
ranks, with most voting along party lines more than 97 per cent
of the time. But Conservative MPs are overwhelmingly more likely
to break rank than members from other parties. The project began
by scraping 600 pages of parliamentary voting data. We designed
a scraper in Python that trudged through these pages, scraping
the MP’s name, party, riding and vote. All told, we had 162,280
votes between June 2, 2011 and Jan. 28, 2013. The next step was
determining whether the MP voted with or against their party. We
first believed we could check this against the whip’s vote. But
we ran into trouble when we realized the party whip was
sometimes (unsurprisingly) absent. We decided to measure each
MP’s vote against th