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

Reading empty lines not possible #159

Closed
yannik131 opened this issue Mar 6, 2024 · 2 comments
Closed

Reading empty lines not possible #159

yannik131 opened this issue Mar 6, 2024 · 2 comments
Assignees
Labels

Comments

@yannik131
Copy link

yannik131 commented Mar 6, 2024

Description:
I have empty lines like ",,,,," in my csv file and want to read them using doc.GetColumn<double>("...");. Empty lines should have a default value or need to be skipped. I tried using rapidcsv::LineReaderParams(true /* pSkipCommentLines */, ',' /* pCommentPrefix */, true /* pSkipEmptyLines */) but rapidcsv still tries to read the line and fails. How do I skip lines like this?

@d99kris
Copy link
Owner

d99kris commented Mar 6, 2024

Such lines cannot be ignored/skpped currently. One can however use ConverterParams and specify pHasDefaultConverter = true to have those empty cells interpreted as default values (which may be customized using pDefaultFloat and pDefaultInteger). By default they would be 0 for integers and std::numeric_limits<long double>::signaling_NaN() for floats.

@d99kris
Copy link
Owner

d99kris commented Mar 20, 2024

I will proceed to close this issue, feel free to re-open it if above suggestion did not help. In this case, please provide a small code sample and CSV file example.

@d99kris d99kris closed this as completed Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants