Process a CSV where each line has varying headers
Closed this issue · 1 comments
deathwishdave commented
Hello, I am trying to process a common format for weather data, the EPW file. Here is an example
The first 8 lines contain varying csv data, each line with its own headers.
Can this be processed with this library please?
ben-strasser commented
Hi,
What you can do is create a CSVReader, then call 8 times next_line on
it. This will give you the first eight lines unmodified. Next you call
set_header to give the column names (which are only used in the error
messages), and then read_row will work for the rest.
This setup will work, but it is kind of a hack. I am uncertain whether
you gain enough using this library for this application to justify the
extra dependency.
Best Regards
Ben Strasser