Bilingual Translation
Purpose
This exercise turns the week into a concrete artifact: one small R analysis, one Python translation, and one audit note showing that the outputs agree.
Required Task
Translate the Week 5 R-deepening summary into Python/pandas:
- Start from the R pipeline in R Deepening and Parity Check.
- Create the Python translation in your personal workspace at
assignments/assignment04-polyglot/submission/translation.ipynb. - From that notebook, load the NHANES CSV from
../../../examples/nhanes-equity/data/nhanes_equity_v6.csv. - Recreate the BMI-by-income-and-gender summary in Python.
- Compare the Python output to the R output using row counts, grouping labels, and rounded summary values.
- Extract one Python helper into
helpers.pyand call it from the notebook. - Add a Markdown cell explaining what AI helped with and how you verified the result.
- Clear notebook outputs before committing.
Parity Table Template
| Check | R result | Python result | Match? | Notes |
|---|---|---|---|---|
| Raw row count | ||||
| Filtered row count | ||||
| Number of grouped rows | ||||
| Mean BMI values after rounding | ||||
| Group labels |
AI Prompt
I have a working R
dplyrsummary. Translate it to Python/pandas one step at a time. After each step, tell me exactly what output to compare with R. Do not add new variables, filters, plots, or interpretation.
Definition of Done
Your exercise is complete when a reader can open the notebook, rerun the cells in order, and see why the R and Python outputs do or do not match.