-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Standardize malformed row handling in Python engine #15913
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
BUG: Standardize malformed row handling in Python engine #15913
Conversation
pandas/io/parsers.py
Outdated
elif 'newline inside string' in msg: | ||
msg = ('EOF inside string starting with ' | ||
'line ' + str(kwargs['row_num'])) | ||
raise Exception(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a plain Exception? shouldn't it be a ValueError?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied from where it was originally, which according to the blame was refactored by you! 😄
In any case, I agree: we should just remove that line and raise csv.Error
now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm don't remember that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah csv.Error sounds fine
make a note of this in the whatsnew though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, done.
Codecov Report
@@ Coverage Diff @@
## master #15913 +/- ##
==========================================
+ Coverage 90.95% 90.96% +<.01%
==========================================
Files 145 145
Lines 49534 49531 -3
==========================================
- Hits 45056 45055 -1
+ Misses 4478 4476 -2
Continue to review full report at Codecov.
|
e0157d6
to
884387e
Compare
@jreback : Everything is green and ready to go. |
thanks @gfyoung |
Wrap
next(source)
whensource
is a file-buffer object to allow for more uniform error message displaying in the Python engine. Closes #15910.