You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Say I have a CSV file with 30 columns, an unreliable header (but order is guaranteed), and I only care about 4 columns. So, I've got to call set_header with 30 names for the columns. Then in my read call I need to pass 30 variables. Is that correct? Seems cumbersome, even if I needed all 30 columns. It would be nice to have an option where the row elements are returned in std::vector and then I do the data type conversions myself for the columns I need.
The text was updated successfully, but these errors were encountered:
Hi,
if you want a vector, use LineReader and split the string at the separator.
I think what you really want is something like:
CSVReader::set_partial_header(ignore_column ignore_policy, string_type
col_name1, int col_pos1, string_type col_name2, int col_pos2 ...)
This should not be too hard to implement. What you need to do is fill
the following CSAReader members: col_order, column_names, ignore_policy.
I think the function would essentially need to do:
this->ignore_policy = ignore_policy;
this->col_order = {col_pos1, col_pos2, ...};
this->col_name = {col_name1, col_name2, ...};
Tested pull requests are welcome.
Best Regards
Ben Strasser
Is it possible that we can set header but not make it compulsory.
someone might choose not to fill, currently it is crashing if we set it but don't fill in csv file
Say I have a CSV file with 30 columns, an unreliable header (but order is guaranteed), and I only care about 4 columns. So, I've got to call set_header with 30 names for the columns. Then in my read call I need to pass 30 variables. Is that correct? Seems cumbersome, even if I needed all 30 columns. It would be nice to have an option where the row elements are returned in std::vector and then I do the data type conversions myself for the columns I need.
The text was updated successfully, but these errors were encountered: