-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
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
Changes from 2 commits
7fd8464
f9f436a
d4156f5
42ea45f
c7dd12e
acd5d1d
40cb3aa
eb91702
9b254eb
bef020a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,35 +53,38 @@ | |
Parameters | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
---------- | ||
buf : StringIO-like, optional | ||
buffer to write to | ||
columns : sequence, optional | ||
the subset of columns to write; default None writes all columns | ||
Buffer to write to. | ||
columns : sequence, optional, default None | ||
The subset of columns to write. The default None writes all columns. | ||
col_space : int, optional | ||
the minimum width of each column | ||
The minimum width of each column. | ||
header : bool, optional | ||
%(header)s | ||
index : bool, optional | ||
whether to print index (row) labels, default True | ||
na_rep : string, optional | ||
string representation of NAN to use, default 'NaN' | ||
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 commentThe 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. |
||
index : bool, optional, default True | ||
Whether to print index (row) labels. | ||
na_rep : str, optional, default 'NaN' | ||
String representation of NAN to use. | ||
formatters : list or dict of one-param. functions, optional, default None | ||
Formatter functions to apply to columns' elements by position or name. | ||
The result of each function must be a unicode string. | ||
List must be of length equal to the number of columns. | ||
float_format : one-parameter function, optional | ||
formatter function to apply to columns' elements if they are floats, | ||
default None. The result of this function must be a unicode string. | ||
sparsify : bool, optional | ||
float_format : one-parameter function, optional, default None | ||
Formatter function to apply to columns' elements if they are floats. | ||
The result of this function must be a unicode string. | ||
sparsify : bool, optional, default True | ||
Set to False for a DataFrame with a hierarchical index to print every | ||
multiindex key at each row, default True | ||
index_names : bool, optional | ||
Prints the names of the indexes, default True | ||
line_width : int, optional | ||
Width to wrap a line in characters, default no wrap | ||
table_id : str, optional | ||
id for the <table> element create by to_html | ||
|
||
.. versionadded:: 0.23.0""" | ||
multiindex key at each row. | ||
index_names : bool, optional, default True | ||
Prints the names of the indexes. | ||
line_width : int, optional, default no wrap | ||
Width to wrap a line in characters. | ||
max_rows : int, optional | ||
Maximum number of rows to display in the console. | ||
max_cols : int, optional | ||
Maximum number of columns to display in the console. | ||
show_dimensions : bool, default False | ||
Display dataframe's dimensions (number of rows by number of columns). | ||
""" | ||
|
||
_VALID_JUSTIFY_PARAMETERS = ("left", "right", "center", "justify", | ||
"justify-all", "start", "end", "inherit", | ||
|
@@ -103,14 +106,14 @@ | |
* inherit | ||
* match-parent | ||
* initial | ||
* unset | ||
* unset. | ||
""" | ||
|
||
return_docstring = """ | ||
|
||
Returns | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
------- | ||
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 commentThe 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. |
||
""" | ||
|
||
docstring_to_string = common_docstring + justify_docstring + return_docstring | ||
|
||
|
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.