-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Improved the docstring of errors.ParserWarning #20076
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
DOC: Improved the docstring of errors.ParserWarning #20076
Conversation
Hello @joaoavf! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on March 15, 2018 at 19:28 Hours UTC |
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.
Looks great, added couple of comments.
pandas/errors/__init__.py
Outdated
>>> df = pd.read_csv(io.StringIO(csv), sep='[;,]') | ||
Traceback (most recent call last): | ||
... | ||
ParserWarning: Falling back to the 'python' engine... |
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.
did you check why the validation says that this test didn't pass, and that the read_csv
returned nothing?
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.
When I ran the code in my console I had this warning displayed: 'ParserWarning: Falling back to the 'python' engine...'
I thought it might have something to do as it is a warning and not an error. Something along the lines that the kind of output generated by an error could be caught by Traceback but not the output of a warning.
Any ideas on how to fix and approach this?
pandas/errors/__init__.py
Outdated
parsing particular attributes of a CSV file with the requested engine. | ||
Warning raised in `pd.read_csv` and `pd.read_table` when it is | ||
necessary to change parsers, generally from 'c' to 'python'. | ||
|
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.
The first line needs to fit in a line. Can you write something more concise please? This paragraph is really useful, and it surely needs to be in the description, but the first line is used in some summaries that should be shorter. Something like Warning raised when reading a table does not use the default parser
. Not sure if it's accurate or fits in one line, but to give you an idea.
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.
Great Mark! Thanks for the suggestion. Already commited my version of it.
pandas/errors/__init__.py
Outdated
|
||
The warning can be avoided by adding `engine='python'` as a parameter | ||
in `pd.read_csv` and `pd.read_table` methods. | ||
|
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.
I think read_csv
and read_table
are good candidates for a See Also
section, as you're mentioning them.
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.
Added a See Also
section with read_csv
and read_table
.
Codecov Report
@@ Coverage Diff @@
## master #20076 +/- ##
==========================================
+ Coverage 91.7% 91.7% +<.01%
==========================================
Files 150 150
Lines 49122 49152 +30
==========================================
+ Hits 45045 45074 +29
- Misses 4077 4078 +1
Continue to review full report at Codecov.
|
pandas/errors/__init__.py
Outdated
parsing particular attributes of a CSV file with the requested engine. | ||
Warning raised when reading a file that doesn't use the default parser. | ||
|
||
Thrown by `pd.read_csv` and `pd.read_table` when it is necessary to |
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.
Thrown -> Raised
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.
Jeff, I made all the changes you requested. Thank you for the feedback.
pandas/errors/__init__.py
Outdated
to change parsers (generally from 'c' to 'python') contrary to the | ||
one specified by the user due to lack of support or functionality for | ||
parsing particular attributes of a CSV file with the requested engine. | ||
Warning raised when reading a file that doesn't use the default parser. |
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.
say default is the c parser
pandas/errors/__init__.py
Outdated
Thrown by `pd.read_csv` and `pd.read_table` when it is necessary to | ||
change parsers, generally from 'c' to 'python'. | ||
|
||
It happens due to lack of support or functionality for parsing |
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.
due to a lack
for parsing a particular attribute
pandas/errors/__init__.py
Outdated
It happens due to lack of support or functionality for parsing | ||
particular attributes of a CSV file with the requested engine. | ||
|
||
Currently, C-unsupported options include the following parameters: |
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.
'c' unsupported options
[ci skip]
#20309 (comment) for doctesting warnings. Thanks @joaoavf |
Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):
scripts/validate_docstrings.py <your-function-or-method>
git diff upstream/master -u -- "*.py" | flake8 --diff
python doc/make.py --single <your-function-or-method>
Please include the output of the validation script below between the "```" ticks:
I am documenting a Warning and I could not find a better way to display the warning in the html example other than using a "Traceback (most recent call last):" followed by "ParserWarning: Falling back to the 'python' engine..." in the docstring.
It also says that it found errors about "No returns sections found". On what I understood this is not relevant to the docstring in hand.