Split Delimited Column into Separate Columns with Pandas
Beginner Mode
Start your terminal to use beginner mode.
Scenario
A CSV file contains a column with comma-delimited data that needs to be split into separate columns for easier analysis.
Task
Write a Python script at /home/interview/split_columns.py using pandas that reads /home/interview/data.csv, splits the full_info column into separate columns (first_name, last_name, age), and saves the result to /home/interview/split_data.csv.
Note: pandas is already installed.
Example
Input (data.csv):
id,full_info
1,"John,Doe,30"
2,"Jane,Smith,25"
Expected output (split_data.csv):
id,first_name,last_name,age
1,John,Doe,30
2,Jane,Smith,25
Terminal requires a larger screen
Open this page on a desktop or tablet (≥ 768px) to launch the terminal and practice hands-on.
Linux Terminal Environment
Write and execute your solution in the terminal below.
Track
| Question | Difficulty | Company | Access |
|---|
Need more practice in this area? Explore more questions →
Snowflake