This project analyzes electoral data using Python, SQL, and Microsoft Power BI. It involves downloading election results from Basededados using Python and performing data transformation and analysis in Power BI.
-
Downloading Election Results:
- Used Python with
basedosdados
library to download the CSV file "resultados_candidato_municipio_zona" from Basededados.
import basedosdados as bd df = bd.read_table(dataset_id='br_tse_eleicoes', table_id='resultados_candidato_municipio_zona', billing_project_id="<YOUR_PROJECT_ID>") df.to_csv("resultados_candidato_municipio_zona.csv")
- Used Python with
-
Web Data Extraction for Political Spectrum:
- Extracted political spectrum data from todapolitica website using Power BI's web data connector.
- Transformed the data in Power Query to categorize into five political spectrum categories: Esquerda (Left), Centro-esquerda (Center-Left), Centro (Center), Centro-direita (Center-Right), and Direita (Right).
- Star Schema Modeling:
- Utilized a star schema with fact and dimension tables:
- Fact Table:
resultados_candidato
storing historical electoral data. - Dimension Tables:
Calendario
,zonas_sp
, andPartidos políticos do Brasil
describing dimensions related to electoral results.
- Fact Table:
- Utilized a star schema with fact and dimension tables:
- DAX Measures Creation:
- Created measures in Power BI using DAX to derive new insights from the data
Explore the final analysis and insights derived from the electoral data in Power BI here.