-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: update the pandas.DataFrame.to_string docstring #20173
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: update the pandas.DataFrame.to_string docstring #20173
Conversation
Had to correct parameters descriptions in common docstrings (format.py) as well as in frame.py.
…tters parameter description.
pandas/io/formats/format.py
Outdated
formatters : list or dict of one-parameter functions, optional | ||
formatter functions to apply to columns' elements by position or name, | ||
default None. The result of each function must be a unicode string. | ||
%(header)s. |
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.
Substituting the header here won't break lines at 79 characters. Not sure this is worth fixing though.
pandas/core/frame.py
Outdated
See Also | ||
-------- | ||
pandas.DataFrame.to_html | ||
Convert dataframe to a html file. |
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 method explanation should be after the method itself separated by space, colon (:) and space. A second line is allowed if the explanation doesn't fit in one line.
@@ -53,35 +53,38 @@ | |||
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.
Parameters should go before the See Also section, right after the Extended Summary.
pandas/io/formats/format.py
Outdated
""" | ||
|
||
return_docstring = """ | ||
|
||
Returns |
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 Returns section should go after the Parameters section and before the See Also section.
pandas/io/formats/format.py
Outdated
Returns | ||
------- | ||
formatted : string (or unicode, depending on data and options)""" | ||
formatted : str (or unicode, depending on data and options) |
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 return explanation is missing. It should go in the next line, indented.
Hi, I have a bit of a problem here as the docstring for this method is a result of concatenation of common docstrings, method’s docstring and a return docstring. |
Fixed See Also description to match the standard.
Codecov Report
@@ Coverage Diff @@
## master #20173 +/- ##
==========================================
- Coverage 91.9% 91.9% -0.01%
==========================================
Files 160 160
Lines 49892 49891 -1
==========================================
- Hits 45852 45851 -1
Misses 4040 4040
Continue to review full report at Codecov.
|
As an attachement there is a zipped html rendering of the command: pandas.DataFrame.to_string.zip It looks ok to me. |
Taking a look at this one! |
Ended up being a rather complicated fixup - @datapythonista could use a second set of eyes if you have time |
Thanks @Tomasz-Kluczkowski ! |
Had to correct parameters descriptions in common docstrings (format.py) as well as in frame.py.
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:
If the validation script still gives errors, but you think there is a good reason
to deviate in this case (and there are certainly such cases), please state this
explicitly.
Checklist for other PRs (remove this part if you are doing a PR for the pandas documentation sprint):
git diff upstream/master -u -- "*.py" | flake8 --diff