
Choose JSON or CSV by the Shape of Your Python Project’s DataPython · INSIGHTFile formats solve different problems. Choose a format by the structure you need to preserve and the tools that will read it, rather than using whichever extension appeared in the last tutorial.
Inspect the data shape
A fictional attendance table with the same fields on every row fits naturally into a tabular format such as CSV. A settings document containing nested sections and lists may be more naturally represented as JSON.
Define types and missing values
CSV fields are text that your application interprets. A value such as “0012” might be an identifier rather than the number twelve. JSON can represent several basic value types, but your program still needs rules for which fields are required and what values mean.
Plan interoperability
If people will open the file in spreadsheet software, test how identifiers, dates, and leading zeros are handled. If another program consumes it, document the schema and version expectations. A valid file can still violate the receiving program’s contract.
Test a round trip
Write a small dataset, read it back, and compare the meaningful values. Include punctuation, non-English text, missing values, and a nested example when relevant. Be explicit about text encoding.
Do not store passwords or private personal information in a practice file that will be published. Use fictional data and keep configuration secrets separate.
Technical reference: Python’s input and output tutorial. Your portfolio note should explain the chosen format, the rejected alternative, and the checks that confirm the data survives a round trip.
Created with AI assistance for JobJet. Illustrative exercises use fictional data; no employer outcomes are promised.