An interactive SQL, Python, Pandas, ETL and data quality lab demonstrating how disorganized datasets become reliable analytical assets.
The simulated dataset carries duplicates, missing values, inconsistent formats and invalid dates. The lab uses SQL, Python and Pandas to investigate, clean and validate them. It then exports an analysis-ready dataset.
All data is fictional and deterministic. No sensitive fiscal, personal or institutional information is used.
The queries and pipelines shown are safe technical demonstrations. Results are computed from a simulated dataset using deterministic functions equivalent to the SQL and Pandas operations displayed.
This is how data arrives: fields as text, mixed formats and real extraction defects. The first rows below already contain some of the problems the audit detects.
First rows of the simulated raw dataset.
id
competence_date
revenue_name
category
estimated_value
collected_value
R-2025-1101-01
2025-01-01
ISS
tributaria
3780
3667
R-2025-1101-02
2025-02-01
ISS
tributaria
3636
3636
R-2025-1101-03
2025-03-01
ISS
tributaria
3492
3597
R-2025-1101-03
2025-04-01
ISS
tributaria
3348
3549
R-2025-1101-05
2025-05-01
ISS
tributaria
3816
3587
R-2025-1101-06
2025-13-45
ISS
tributaria
3672
3562
Investigating with SQL
Ten preset queries cover the investigation cycle: trend, gap, duplicate/missing/validity audits, ranking, running total, outliers and the final BI-ready dataset.
Basicruns over the cleaned dataset
Purpose: Group the simulated revenue by competence month and spot the trend.
SELECT
strftime('%Y-%m', competence_date) AS competence_month,
SUM(collected_value) AS collected_revenue
FROM revenue_clean
GROUP BY competence_month
ORDER BY competence_month;
Result of "Collected revenue by month" — 12 row(s) total.
competence_month
collected_revenue
2025-01
7,211
2025-02
12,211
2025-03
11,157
2025-04
7,754.56
2025-05
11,495
2025-06
7,189
2025-07
10,569
2025-08
50,529
Executive reading: The monthly view is the base of executive tracking: consecutive drops raise alerts.
The queries and pipelines shown are safe technical demonstrations. Results are computed from a simulated dataset using deterministic functions equivalent to the SQL and Pandas operations displayed.
Python + Pandas pipeline
Each step below shows the problem, the conceptual Pandas code and — on execution — how many records are actually affected in the simulated dataset.
01Read and standardize columns
Problem: Columns with spaces, mixed casing and divergent names break downstream scripts.
Run the pipeline to audit the dataset, apply the deterministic transformations, compare before/after and unlock the cleaned dataset export.
Run the pipeline to see the log, the metrics and the before/after comparison.
Flow architecture
From extraction to decision: the same data goes through investigation, cleansing, auditing and publication — ending in the Power BI case's executive dashboard.
Raw CSV
SQL investigation
Python / Pandas
Data quality
Clean dataset
Power BI
Executive decision
Next: BI and decision-making
The dataset cleaned in this lab shares the same domain as the Power BI case — fiscal KPIs, targets and municipal revenue. See the data applied in the executive dashboard.