Skip to content

BUG: Fixes StopIteration error from 'np.genfromtext' for empty file with skip_header > 0 #14252

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

Merged
merged 1 commit into from
Aug 15, 2019

Conversation

maxwell-aladago
Copy link
Contributor

#14225

Instead of throwing a StopIteration error when skip_header > 0 for an empty file, it returns a UserWarning and an empty list. This behaviour is consistent with skip_header=0, max_rows > 0 and skip_rows > 0.

@maxwell-aladago maxwell-aladago changed the title ENH: Fixes StopIteration error for empty file with skip_header > 0 ENH: Fixes StopIteration error from 'np.genfromtext' for empty file with skip_header > 0 Aug 11, 2019
@charris
Copy link
Member

charris commented Aug 12, 2019

Note that enhancements need a release note.

@charris charris added the 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes label Aug 12, 2019
@eric-wieser
Copy link
Member

eric-wieser commented Aug 12, 2019

This strikes me as a bug fix - raising StopIteration outside of a __next__ method is just wrong.

@charris charris changed the title ENH: Fixes StopIteration error from 'np.genfromtext' for empty file with skip_header > 0 BUG: Fixes StopIteration error from 'np.genfromtext' for empty file with skip_header > 0 Aug 14, 2019
@charris charris removed the 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes label Aug 14, 2019
@charris charris merged commit 908fa68 into numpy:master Aug 15, 2019
@charris
Copy link
Member

charris commented Aug 15, 2019

Thanks @maxwell-aladago .

@maxwell-aladago
Copy link
Contributor Author

Thanks @maxwell-aladago .

Thank you too. It’s been a pleasure. I am a novice, and I want to be contributing as much as I can. I like how organised the NumPy library is, many open source projects don’t have such well organised code. Thanks for the awesome work you do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants