Drills tagged with this skill, unpassed first. Pass them all to mark the skill ready for scenarios.
build_scores_df(names, scores) that returns a DataFrame with two columns, name and score, where each row pairs a name with its score (same index).
Example. names=["Alice","Bob"], scores=[85,92] →
| name | score |
|-------|-------|
| Alice | 85 |
| Bob | 92 |
Notes. Both inputs are always the same length. Empty inputs → empty DataFrame with both columns present.describe_shape(df) that returns a dict with three keys: "rows" (number of rows), "columns" (number of columns), "column_names" (list of column names in their original order).
Example. A 2×3 DataFrame with columns a, b, c → {"rows": 2, "columns": 3, "column_names": ["a", "b", "c"]}.
Notes. Works on any DataFrame, including empty ones (0 rows but columns still defined).n, return only the first n rows.
Your task. Write first_n(df, n) that returns a DataFrame containing the first n rows of df, preserving the original column order.
Example. A 5-row df with n=2 → the first 2 rows as a DataFrame.
Notes. If n is larger than the number of rows, return all rows. If n is 0, return an empty DataFrame (same columns, no rows).