Preserve df.
The editable setup on the right creates df. Run executes the setup and your work from top to bottom.
Your requirements
- Display a DataFrame with one row for each original column.
- Name its two columns dtype (data type as text) and missing (number of missing values).
Your inputs
| order | drink | size | price | tip | date |
|---|---|---|---|---|---|
| 101 | " latte " | LARGE | 6.20 | 1 | 2026-06-01 |
| 102 | TEA | small | 3.10 | 0.5 | 2026-06-02 |
| 103 | " mocha " | LARGE | oops | None | not a date |
| 104 | Latte | Small | None | 0.8 | 2026-06-04 |
| 104 | Latte | Small | None | 0.8 | 2026-06-04 |
| 105 | "tea " | SMALL | 4.20 | 0.6 | 2026-06-05 |
| 106 | ESPRESSO | small | 2.50 | 0.2 | 2026-06-06 |
| 107 | " mocha" | large | 6.80 | 1.5 | 2026-06-07 |
Remember the idea
Inspect field quality before choosing records and summaries for a question.
A small example
A column-quality table puts each original field beside its storage type and missing count.
| Code or choice | Meaning |
|---|---|
df.dtypes.astype(str) | Convert each dtype to text for the quality table. |
df.isna().sum() | Count missing entries in each field. |
pd.DataFrame(...) | Align the two Series by field name into one table. |
Hint
Put each field on one row so its storage type and missing count can be checked together.
Reveal solution
One way to do it. Keep any supplied setup in the editor and use this in the Your work section.
pd.DataFrame(
{
"dtype": df.dtypes.astype(str),
"missing": df.isna().sum(),
}
)