-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: update the pandas.core.generic.NDFrame.to_clipboard docstring #20134
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.core.generic.NDFrame.to_clipboard docstring #20134
Conversation
Hello @dandxy89! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on March 13, 2018 at 20:48 Hours UTC |
pandas/core/generic.py
Outdated
other keywords are passed to to_csv | ||
excel : bool | ||
Default setting for this argument is True. | ||
If True, use the provided separator, writing in a csv format for |
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.
@jorisvandenbossche I think we indenting or '-' here to separate these cases?
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.
Depends on the context, in this case for True/False I think it is fine as sentences (but if there are more options certainly better to explicitly use lists)
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.
Don't think we have a policy. But I think
- True : use the provided separator,...
- False : ...
looks nice.
pandas/core/generic.py
Outdated
Field delimiter. | ||
kwargs : optional | ||
These parameters will be passed to either | ||
:py:meth:`pandas.DataFrame.to_csv` |
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.
don't need the ':py:' prefix
pandas/core/generic.py
Outdated
to the clipboard | ||
sep : optional, defaults to tab | ||
other keywords are passed to to_csv | ||
excel : bool |
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.
Default would go on this line. so bool, default True
.
pandas/core/generic.py
Outdated
|
||
See Also | ||
-------- | ||
pandas.core.frame.DataFrame.to_csv : Write a DataFrame to a |
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.
Just DataFrame.to_csv
pandas/core/generic.py
Outdated
-------- | ||
pandas.core.frame.DataFrame.to_csv : Write a DataFrame to a | ||
comma-separated values (csv) file. | ||
pandas.core.series.Series.to_csv : Write a Series to a |
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.
Just Series.to_csv
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.
Thanks for the PR! Added some more comments
pandas/core/generic.py
Outdated
to the clipboard | ||
sep : optional, defaults to tab | ||
other keywords are passed to to_csv | ||
excel : bool |
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.
please leave the default: bool, default True
pandas/core/generic.py
Outdated
other keywords are passed to to_csv | ||
excel : bool | ||
Default setting for this argument is True. | ||
If True, use the provided separator, writing in a csv format for |
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.
Depends on the context, in this case for True/False I think it is fine as sentences (but if there are more options certainly better to explicitly use lists)
pandas/core/generic.py
Outdated
clipboard. | ||
sep : str, default tab | ||
Field delimiter. | ||
kwargs : optional |
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.
kwargs : optional
-> **kwargs
pandas/core/generic.py
Outdated
These parameters will be passed to either | ||
:py:meth:`pandas.DataFrame.to_csv` | ||
or :py:meth:`pandas.Series.to_csv` methods depending on the | ||
Object type. |
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.
Since they actually have the same optional keyword, I would just refer to DataFrame.to_csv to keep it a bit shorter
pandas/core/generic.py
Outdated
|
||
See Also | ||
-------- | ||
pandas.core.frame.DataFrame.to_csv : Write a DataFrame to a |
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.
pandas.core.frame.DataFrame.to_csv
-> DataFrame.to_csv
(same below)
would also refer to read_clipboard
pandas/core/generic.py
Outdated
>>> df.to_clipboard() | ||
|
||
We can omit the the index by passing the keyword 'index' and setting | ||
it to false. |
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.
Remove the leading space here.
pandas/core/generic.py
Outdated
>>> df = pd.DataFrame([[1, 2, 3], [4, 5, 6]], columns=['A', 'B', 'C']) | ||
>>> df.to_clipboard() | ||
|
||
We can omit the the index by passing the keyword 'index' and setting |
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.
backticks for "index" instead of quotes
@jreback ready for a review. |
Codecov Report
@@ Coverage Diff @@
## master #20134 +/- ##
==========================================
- Coverage 91.72% 91.7% -0.03%
==========================================
Files 150 150
Lines 49156 49152 -4
==========================================
- Hits 45090 45074 -16
- Misses 4066 4078 +12
Continue to review full report at Codecov.
|
Used the same trick as DtypeWarning for showing the "output" of to_clipboard. Thanks @dandxy89! |
Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):
scripts/validate_docstrings.py pandas.core.generic.NDFrame.to_clipboard
git diff upstream/master -u -- "*.py" | flake8 --diff
python doc/make.py --single pandas.core.generic.NDFrame.to_clipboard
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.