Load and Inspect Data
What to do on this page: run the Python code below as written, in translation.ipynb, one cell at a time — click the play button beside each cell or press Shift+Enter, and the output appears below the cell. You are not asked to translate this Python into R or to modify it. Instead, compare each output with the matching R command in the table at the bottom; you built the R side in R Deepening and Parity Check.
Load The NHANES Snapshot
In translation.ipynb, load the same CSV used in the R example:
Inspect Before Summarising
Compare To R
| Question | R | Python |
|---|---|---|
| How many rows? | nrow(nhanes) |
len(nhanes) |
| How many columns? | ncol(nhanes) |
nhanes.shape[1] |
| What are the column names? | names(nhanes) |
nhanes.columns.tolist() |
| How many missing BMI values? | sum(is.na(nhanes$BMI)) |
nhanes["BMI"].isna().sum() |
Student Check
Before asking AI for any transformation, write down the raw row count, column count, and missingness count for BMI.