BuildlyBuildly
DashboardExercisesProfileHelp
Data Science/Module 2: Data Analytics/CSV I/O (basic)2/3
Exercise·7 min·10 XP

Parse a CSV String

Context. A CSV string pulled from an API needs to be parsed into a DataFrame.

Your task. Write parse_csv(csv_text) that takes a CSV-formatted string (header row present) and returns a DataFrame.

Example. "a,b\n1,2\n3,4" → 2-row DataFrame with columns a and b.

Notes. Use io.StringIO to wrap the string so pd.read_csv can read it like a file. Always has a header row.

Previous
First N Rows
Next
Serialize to a CSV String