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

Incorrect n_rows() value when using iterators to loop over the data #173

Closed
sjoubert opened this issue Jun 24, 2021 · 2 comments
Closed
Assignees
Labels

Comments

@sjoubert
Copy link

When using iterator (either old style begin()/end() or through a range-for loop) the value returned by n_rows() is off by 1. This does not happen when using the read_row pattern in a loop.

From what I can tell, the issue seems to come from CSVReader::begin() which gets a data row and construct the first iterator without incrementing the counter. Later ++ calls on the iterator correctly do that through a read_row call.

A possible fix may be to just replace the current approach of begin with a call to read_row instead of explicitly retrieving the data.

@sjoubert
Copy link
Author

sjoubert commented Aug 6, 2021

This may be the cause of #151 depending on the loop method used there.

@vincentlaucsb vincentlaucsb self-assigned this May 20, 2024
vincentlaucsb added a commit that referenced this issue May 26, 2024
@vincentlaucsb
Copy link
Owner

Thanks for your report. Your diagnosis was correct and this issue has been fixed.

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