CSV.parse - Support Headers #15170
Labels
good first issue
This is an issue suited for newcomers to become aquianted with working on the codebase.
kind:feature
topic:stdlib:text
Feature Request
Whilst it's good that CSV is implemented as an efficient parser that iterates over data as it's needed, sometimes it's convenient to read the lot in as one big array of arrays.
The constructor for CSV has an optional
headers
argument for handling a header row automatically, whilst the parse static method returns an array of arrays of strings for grabbing the thing as a table. Often I'd like to get a table in one line, but also use a header row.So I'd like to propose adding this to the parse method, and I think the most suitable option would be, if headers is true in parse, to return an array of hashes, so that I can index by row and then extract the cell through its column key from the hash.
Thanks
The text was updated successfully, but these errors were encountered: