Datasets:
Upload folder using huggingface_hub
Browse files- README.md +146 -0
- data/candidates.parquet +3 -0
- data/dados_preditivos_mt_2026.parquet +3 -0
- data/polling_places.parquet +3 -0
- data/section_polling_places.parquet +3 -0
- data/votes.parquet +3 -0
- data/votes_geo.parquet +3 -0
- mt_municipios.geojson +0 -0
README.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- tabular
|
| 5 |
+
tags:
|
| 6 |
+
- electoral
|
| 7 |
+
- geography
|
| 8 |
+
- brazil
|
| 9 |
+
- duckdb
|
| 10 |
+
- parquet
|
| 11 |
+
- geocoding
|
| 12 |
+
- mato-grosso
|
| 13 |
+
pretty_name: Mato Grosso Electoral & Geolocated Voting Dataset (2014-2024)
|
| 14 |
+
language:
|
| 15 |
+
- pt
|
| 16 |
+
- en
|
| 17 |
+
size_categories:
|
| 18 |
+
- 1M<n<10M
|
| 19 |
+
configs:
|
| 20 |
+
- config_name: votes_geo
|
| 21 |
+
data_files:
|
| 22 |
+
- split: train
|
| 23 |
+
path: data/votes_geo.parquet
|
| 24 |
+
- config_name: votes
|
| 25 |
+
data_files:
|
| 26 |
+
- split: train
|
| 27 |
+
path: data/votes.parquet
|
| 28 |
+
- config_name: candidates
|
| 29 |
+
data_files:
|
| 30 |
+
- split: train
|
| 31 |
+
path: data/candidates.parquet
|
| 32 |
+
- config_name: polling_places
|
| 33 |
+
data_files:
|
| 34 |
+
- split: train
|
| 35 |
+
path: data/polling_places.parquet
|
| 36 |
+
- config_name: section_polling_places
|
| 37 |
+
data_files:
|
| 38 |
+
- split: train
|
| 39 |
+
path: data/section_polling_places.parquet
|
| 40 |
+
- config_name: dados_preditivos_mt_2026
|
| 41 |
+
data_files:
|
| 42 |
+
- split: train
|
| 43 |
+
path: data/dados_preditivos_mt_2026.parquet
|
| 44 |
+
---
|
| 45 |
+
|
| 46 |
+
# Mato Grosso Electoral & Geolocated Voting Dataset (2014-2024)
|
| 47 |
+
|
| 48 |
+
## Dataset Summary
|
| 49 |
+
This dataset contains the complete, cleaned, and geocoded electoral results of Mato Grosso (MT), Brazil, covering the election years **2014, 2018, 2020, 2022, and 2024**. It offers two levels of utilization:
|
| 50 |
+
1. **Relational Schema**: Comprising normalized tables for votes per section, candidate registrations, physical polling places, and section-to-polling-place mappings.
|
| 51 |
+
2. **Denormalized Enriched Table (`votes_geo`)**: A single unified file (~3.8M rows) that maps every vote record directly to its candidates' metadata and the precise physical location (with CEP, neighborhood, latitude, and longitude).
|
| 52 |
+
|
| 53 |
+
This dataset is especially useful for spatial analysis of voting patterns, political geography, and research on electoral behaviors.
|
| 54 |
+
|
| 55 |
+
---
|
| 56 |
+
|
| 57 |
+
## Dataset Structure
|
| 58 |
+
|
| 59 |
+
### 1. `votes_geo` (Unified Geolocated Votes)
|
| 60 |
+
This is the fully denormalized dataset joining election results, candidates, and physical locations.
|
| 61 |
+
* **Size**: 3,823,314 rows
|
| 62 |
+
* **Key Columns**:
|
| 63 |
+
* `ano` (int64): Year of the election.
|
| 64 |
+
* `turno` (int64): Round (1 or 2).
|
| 65 |
+
* `uf` (string): Federation Unit ('MT').
|
| 66 |
+
* `municipio` (string): Name of the municipality.
|
| 67 |
+
* `zona` (int64): Electoral zone number.
|
| 68 |
+
* `secao` (int64): Voting section number.
|
| 69 |
+
* `cargo` (string): Office (e.g. PRESIDENTE, GOVERNADOR, DEPUTADO FEDERAL).
|
| 70 |
+
* `partido` (string): Candidate's political party acronym.
|
| 71 |
+
* `candidato` (string): Candidate name (or VOTO BRANCO / VOTO NULO).
|
| 72 |
+
* `votos` (int64): Quantity of votes in this section.
|
| 73 |
+
* `nome_local_votacao` (string): Polling place name (e.g., school name).
|
| 74 |
+
* `endereco_local_votacao` (string): Raw street address.
|
| 75 |
+
* `cep` (string): Resolved postal code.
|
| 76 |
+
* `bairro` (string): Resolved neighborhood.
|
| 77 |
+
* `latitude` (double): Geocoded latitude.
|
| 78 |
+
* `longitude` (double): Geocoded longitude.
|
| 79 |
+
* `geocode_status` (string): API result status (`success`, `zero_results`, etc.).
|
| 80 |
+
* `geocode_confidence` (string): Confidence level (`high`, `medium`, `low`).
|
| 81 |
+
* `has_manual_correction` (boolean): Flag indicating if coordinates were manually adjusted.
|
| 82 |
+
|
| 83 |
+
### 2. `votes` (Raw Normalized Votes)
|
| 84 |
+
Core table containing electoral results per section.
|
| 85 |
+
* **Size**: 3,823,314 rows
|
| 86 |
+
* **Fields**: Standard TSE columns normalized (e.g., `ano`, `turno`, `codigo_municipio_tse`, `zona`, `secao`, `codigo_cargo`, `cargo`, `numero_candidato`, `candidato`, `partido`, `votos`, `local_votacao`).
|
| 87 |
+
|
| 88 |
+
### 3. `candidates` (Candidate Registry)
|
| 89 |
+
Metadata about candidates running in Mato Grosso.
|
| 90 |
+
* **Size**: 25,682 rows
|
| 91 |
+
* **Fields**: `sq_candidato`, `ano`, `cargo`, `numero_candidato`, `candidato`, `partido`, `situacao_candidatura`, `situacao_turno`, etc.
|
| 92 |
+
|
| 93 |
+
### 4. `polling_places` (Physical Locations)
|
| 94 |
+
Deduplicated physical voting locations with geocoded coordinates.
|
| 95 |
+
* **Size**: 2,142 rows
|
| 96 |
+
* **Fields**: `polling_place_id`, `uf`, `codigo_municipio_tse`, `municipio`, `nome_local_votacao`, `endereco_local_votacao`, `endereco_normalizado`, `cep`, `bairro`, `latitude`, `longitude`, `geocode_confidence`, `geocode_status`, `google_place_id`, `google_formatted_address`.
|
| 97 |
+
|
| 98 |
+
### 5. `section_polling_places` (Temporal Mapping)
|
| 99 |
+
Resolves the mapping between a section (zona + secao) and a physical location (`polling_place_id`) for each election year.
|
| 100 |
+
* **Size**: 36,643 rows
|
| 101 |
+
* **Rationale**: TSE's internal `local_votacao` codes are not stable across years. This mapping tracks where each section was physically located in each year.
|
| 102 |
+
|
| 103 |
+
### 6. `dados_preditivos_mt_2026` (2026 Predictions)
|
| 104 |
+
Aggregated electoral patterns and prediction inputs.
|
| 105 |
+
* **Size**: ~14,000 rows
|
| 106 |
+
|
| 107 |
+
---
|
| 108 |
+
|
| 109 |
+
## Data Origin & Ingestion Pipeline
|
| 110 |
+
|
| 111 |
+
1. **Source Data**: Extracted from the official Open Data portal of the Brazilian Electoral Court (TSE) and IBGE's municipal meshes.
|
| 112 |
+
2. **Deduplication Strategy**: To solve the instability of TSE's `local_votacao` code (where the same code can represent different schools across years, or different codes represent the same school), a unique `polling_place_id` was calculated using:
|
| 113 |
+
`SHA256(uf + codigo_municipio_tse + nome_local_votacao + endereco_normalizado)[:20]`
|
| 114 |
+
3. **Geocoding**: Physical locations were processed using the Google Geocoding API.
|
| 115 |
+
4. **Manual Auditing**: Low-confidence results or coordinates falling outside the Mato Grosso bounding box were manually verified and corrected. The final geolocation coverage is **99.86%**.
|
| 116 |
+
|
| 117 |
+
---
|
| 118 |
+
|
| 119 |
+
## Usage Instructions
|
| 120 |
+
|
| 121 |
+
### Loading with Hugging Face Datasets (Python)
|
| 122 |
+
To load the unified geolocated votes dataset directly in Python:
|
| 123 |
+
```python
|
| 124 |
+
from datasets import load_dataset
|
| 125 |
+
import pandas as pd
|
| 126 |
+
|
| 127 |
+
# Load the denormalized dataset (recommended for spatial queries)
|
| 128 |
+
dataset = load_dataset("andrebadini/eleitoral-mt", name="votes_geo", split="train")
|
| 129 |
+
df = dataset.to_pandas()
|
| 130 |
+
print(df.head())
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
### Querying with DuckDB (SQL)
|
| 134 |
+
DuckDB can read these Parquet files directly from the Hugging Face URL:
|
| 135 |
+
```sql
|
| 136 |
+
SELECT municipio, candidato, SUM(votos) AS total
|
| 137 |
+
FROM read_parquet('https://huggingface.co/datasets/andrebadini/eleitoral-mt/resolve/main/data/votes_geo.parquet')
|
| 138 |
+
WHERE ano = 2022 AND cargo = 'GOVERNADOR'
|
| 139 |
+
GROUP BY municipio, candidato
|
| 140 |
+
ORDER BY total DESC;
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
---
|
| 144 |
+
|
| 145 |
+
## Licensing
|
| 146 |
+
This dataset is distributed under the **Creative Commons Attribution 4.0 International (CC-BY-4.0)** license. You are free to share and adapt the data, provided that you give appropriate credit.
|
data/candidates.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b434db250c0887bcbf1fd019deaf2f014c7455e1161489d86f802908a8d2bbba
|
| 3 |
+
size 1015597
|
data/dados_preditivos_mt_2026.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f609f50db75c06ab4b581db3b0c17701fb07b5076c063e3308ad46b101660885
|
| 3 |
+
size 275223
|
data/polling_places.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0a4bff3d070bacc6b128a721f2ab7b892189be455fc286bf3aa82f70df55bab0
|
| 3 |
+
size 329193
|
data/section_polling_places.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e982c958c8db1c7e357ee970ec600d4261105412825e6fee6257efe46b438e8e
|
| 3 |
+
size 705216
|
data/votes.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7b8e0cd0d087eda1d60831f28b8e068dbf8691c87d18040b262da2fb63543564
|
| 3 |
+
size 64375666
|
data/votes_geo.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c336c755d2e58c6df39f8ff96208b97b2f294f3cbf77b03d6c5b58805afd6658
|
| 3 |
+
size 91736723
|
mt_municipios.geojson
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|