Programming
CSV to Python Objects Converter
Turn CSV data into Python you can paste into a script: a list of dicts, a list of lists, a dict of columns, a pandas DataFrame, or typed dataclasses and NamedTuples. Numbers, booleans and empty cells are converted, while codes like postcodes with leading zeros stay text.
Runs in your browserLive result
Workspace
Options
Leading-zero codes such as 0800 always stay text.
How to use this tool
- 1Paste CSV or open a .csv / .tsv file; the delimiter is detected automatically.
- 2Choose the Python structure.
- 3Check the column types in the notes and adjust type conversion if needed.
- 4Copy the code or download the .py file.
Frequently asked questions
A column becomes int, float or bool only if every non-empty cell fits; otherwise it stays text. Codes with leading zeros such as postcodes (0800) always stay text.
They become None by default (the dataclass and NamedTuple fields are typed Optional), or you can keep them as empty strings.
Commas, semicolons, tabs and pipes are detected automatically, and quoted fields with commas or line breaks are handled.
No. Everything is calculated in your browser; nothing you enter is sent to MuhammadLab.