# clean-and-dedupe

clean a CSV: trim whitespace, normalise case and phone/email formats, and drop duplicate records

- **Space:** data-science-public (https://github.com/Tech-Realm/space-data-science-public/tree/main/clean-and-dedupe)
- **Level:** L2 (as the registry reports it)
- **Keys it needs (names only):** none
- **Tools:** python3
- **Routes:** python-stdlib, pandas; checks: 1
- **Uses:** new (no recorded use yet)
- **Install:** `logicpacks pack use data-science-public/clean-and-dedupe` or MCP `get_pack data-science-public/clean-and-dedupe`
- **Files:** CHANGELOG.md, code/clean.py, outcome/EVIDENCE.md, outcome/checks.yaml, outcome/fixtures/m.csv, outcome/results.json, pack.yaml, refs/refs.yaml, spec/SPEC.md, spec/source.md

## Purpose (spec/SPEC.md)

## Goal

Clean a CSV: trim whitespace, normalise case and phone/email formats, and drop duplicate records.

## Steps

1. Profile the file first (csv-profile).
2. Pick the key columns that identify one real-world record.
3. Run clean.py and spot-check dropped rows.

## Edge cases

- Fuzzy duplicates (typos) need a similarity pass; this does exact-after-normalising.
- Title-casing breaks names like 'McDonald'.

## Don'ts

- Don't overwrite the source file; write a new one.

## Routes (free first)

1. `python-stdlib`: `code/clean.py` (no install).
2. `pandas` (free): same job in pandas for large files (pip install pandas)



---

Canonical URL: https://logicpacks.io/packs/data-science-public/clean-and-dedupe

Developed by TechRealm (techrealm.online), the software team. Operated by Al Jash Trading (Establishment), Abu Dhabi, since 1994, the legal entity that hosts and is responsible for the service. Economic licence CN-1030597, Abu Dhabi Registration Authority. Address: Office 5, Bani Yas West 4, Bani Yas, Abu Dhabi, UAE. Website: https://aljashtrading.com. Contact: hello@logicpacks.io, security@logicpacks.io, WhatsApp +1 713 632 2262 (https://wa.me/17136322262).

Machine-readable index: [/llms.txt](/llms.txt). Plain facts: [/about.md](/about.md). Safety: [/safety.md](/safety.md).
