Peruvian Party Switching: Ideologists or Opportunists?

For the course Computer Science with Applications II, my team and I analyzed and characterized tendencies in party-switching among candidates in the 2020 Peruvian parliamentary elections.

To accomplish our task, we used Selenium to crawl the Peruvian National Jury of Elections website to access the curriculum vitae of each candidate and scrape its contents. We scraped self-reported instances of party switching from CVs as a base for our analyses.
For the data visualization, we made use of criminal record, income, and university degree information from CVs as attributes to characterize these party switches. We also used the 2017 Census and 2018 household survey data to characterize party switchers using the following district-level attributes: poverty rate, Gini index, indigenous share of population, and share of population with no schooling. We used Sankey diagrams to visualize the weight and direction of flows into and out of a central node. The diagrams display the number of party-switching politicians, grouped by party nodes, flowing into and out of a selected party of interest.

Project code can be found here.
Project teammates: Andrei Bartra, Angelo Cozzubo, Marc Richardson

Return to main

Candidate parties switching affiliation to and from Alianza por el Progresso


Somos Peru by candidate criminal record


Somos Peru by candidate district Gini index


Solidaridad Nacional by candidate personal income quartile