Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV Parser Headers #214

Merged
merged 5 commits into from
Aug 1, 2024
Merged

Conversation

steiltre
Copy link
Collaborator

@steiltre steiltre commented Jul 1, 2024

Adds ability to handle headers in CSV files. Requires allowing ygm::io::line_parser to read the first line of the first file independently and skip over the first line of files in for_all operations.

This functionality is controlled by a ygm::io::csv_parser::read_headers() function that parses the header file to create an internal map from column names to positional indices and puts the csv_parser in a state that will skip over processing the header line when calling for_all. This could also be accomplished by adding an optional flag to the csv_parser constructor, but this would break the symmetry in arguments to the constructors of csv_parser and line_parser.

Additionally, this requires adding a class to handle the CSV lines in a way that items can be accessed through positional indices and column name. The interface of this class is created to match that of the std::vector<csv_field> that was used previously, but the full vector interface is not implemented.

@rogerpearce let me know if this change is consistent with any future changes you have planned for the I/O functionality.

…o::line_parser to read the first line of the first file independently and skip over the first line of files in for_all operations.
@steiltre steiltre requested a review from rogerpearce July 1, 2024 03:07
@steiltre steiltre merged commit 2867752 into LLNL:v0.7-dev Aug 1, 2024
8 checks passed
@steiltre steiltre deleted the feature/csv_parser_headers branch August 28, 2024 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant