fix(ofsted): skip title row with header=1 when reading CSV
Some checks failed
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 34s
Build and Push Docker Images / Build Integrator (push) Has been cancelled
Build and Push Docker Images / Build Kestra Init (push) Has been cancelled
Build and Push Docker Images / Trigger Portainer Update (push) Has been cancelled
Build and Push Docker Images / Build Frontend (Next.js) (push) Has been cancelled

The Ofsted MI CSV has a descriptive title on row 0; real column
headers are on row 1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-24 20:55:27 +00:00
parent 4369061c3f
commit 6ba1c42417

View File

@@ -137,9 +137,9 @@ def load(path: Path | None = None, data_dir: Path | None = None) -> dict:
if not csv_names: if not csv_names:
raise ValueError("No CSV found inside Ofsted ZIP") raise ValueError("No CSV found inside Ofsted ZIP")
with z.open(csv_names[0]) as f: with z.open(csv_names[0]) as f:
df = pd.read_csv(io.TextIOWrapper(f, encoding="latin-1"), low_memory=False) df = pd.read_csv(io.TextIOWrapper(f, encoding="latin-1"), low_memory=False, header=1)
else: else:
df = pd.read_csv(path, encoding="latin-1", low_memory=False) df = pd.read_csv(path, encoding="latin-1", low_memory=False, header=1)
# Normalise column names # Normalise column names
df.rename(columns=COLUMN_MAP, inplace=True) df.rename(columns=COLUMN_MAP, inplace=True)