Logo Lanfrica
  • Home
  • Atlas
  • Insights
  • Docs
  • Sign in

© 2026 Lanfrica. All rights reserved. All copyrights of the resources shown on the Lanfrica website belong to the original copyright holders, unless explicitly stated otherwise.

sbjoachim/Uganda-General-elections-Analysis-and-voting-trends

Domain:

socioeconomic
Creator:
sbj
Host:
Key Voting trends in urban areas vs rural areas # Uganda Elections Analysis A personal data project looking at voting patterns in Uganda's 2016 and 2021 presidential elections. ## What This Is I got interested in understanding how electoral patterns work in Uganda after finding the Kalulu open data repository. Rather than just reading news coverage, I wanted to look at the actual numbers - all the way down to polling station level. This notebook analyzes: - How vote shares changed between 2016 and 2021 - Where the opposition is strongest - Whether cities vote differently than rural areas - Which districts have shifted their support over time ## The Data The analysis uses official Electoral Commission results covering: - **2016 Election**: Museveni vs Besigye (main opposition) + other candidates - **2021 Election**: Museveni vs Bobi Wine (main opposition) + other candidates Both datasets include results from every polling station in Uganda, with district-level geographic information. **Note**: 2011 data isn't available yet in the repository, so this focuses on the two most recent elections. ## Running This ### You'll need: ```bash pip install pandas numpy matplotlib seaborn jupyter ``` Or just: ```bash pip install -r requirements.txt ``` ### To run the analysis: ```bash jupyter notebook ``` Then open `uganda_election_analysis.ipynb` and run all cells. ## What You'll Find The notebook generates several visualizations: **National trends** - How the overall vote split has changed **Opposition strongholds** - Districts where Besigye (2016) and Bobi Wine (2021) actually won **Urban vs rural divide** - Pretty stark differences between cities and countryside **Swing analysis** - Which districts moved toward or away from the incumbent **Geographic scatter plots** - Visual representation of where each district falls All charts are automatically saved as high-resolution PNG files. ## Files Generated After running the notebook: - `national_trends.png` - Overview charts - `opposition_strongholds.png` - …

Visit

github.com

Languages

Acipa, Eastern