Skip to main content
🐍 Python Projects

CSV Summarizer

What you're building

A CSVSummarizer that parses a raw CSV string (header row + data rows) and lets you query column statistics β€” the core of any lightweight data tool.

Requirements

  • headers() β€” list of column names
  • column(name) β€” list of values for that column (as strings)
  • numeric_summary(name) β€” for a numeric column, returns {"min": …, "max": …, "avg": …}
data = """name,age,score
Alice,30,88
Bob,25,92
Carol,35,79"""

csv = CSVSummarizer(data)
csv.headers()                   # ["name", "age", "score"]
csv.column("name")              # ["Alice", "Bob", "Carol"]
csv.numeric_summary("score")    # {"min": 79, "max": 92, "avg": 86.33}

Stretch goals

  • row_count() β€” number of data rows (excluding header).
  • find_rows(column, value) β€” return rows where that column equals the value.

What this proves

String parsing without external libraries, list operations, type conversion, and dict construction β€” the exact skills used in data engineering and backend scripting interviews.

⚑ 60 XP
solution.pyRuns in your browser (Pyodide)
Loading editor…
Tests4 to pass
headers returns column names
column returns all values
numeric_summary min and max
numeric_summary avg rounded

Run your code to check these.