-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
Changes from 6 commits
f12a1c0
90d655e
13a3764
10305d8
790ab6e
2961ab1
aaed5ca
3f4e7ce
ea10208
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 |
---|---|---|
|
@@ -1930,25 +1930,52 @@ def to_pickle(self, path, compression='infer', | |
|
||
def to_clipboard(self, excel=True, sep=None, **kwargs): | ||
""" | ||
Attempt to write text representation of object to the system clipboard | ||
Copy object to the system clipboard. | ||
|
||
Write a text representation of object to the system clipboard. | ||
This can be pasted into Excel, for example. | ||
|
||
Parameters | ||
---------- | ||
excel : boolean, defaults to True | ||
if True, use the provided separator, writing in a csv | ||
format for allowing easy pasting into excel. | ||
if False, write a string representation of the object | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Default would go on this line. so |
||
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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Don't think we have a policy. But I think
looks nice. |
||
allowing easy pasting into excel. | ||
If False, write a string representation of the object to the | ||
clipboard. | ||
sep : str, default tab | ||
Field delimiter. | ||
kwargs : optional | ||
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.
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. don't need the ':py:' prefix |
||
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 commentThe 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 |
||
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Just DataFrame.to_csv 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.
would also refer to |
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Just Series.to_csv |
||
comma-separated values (csv) file. | ||
|
||
Notes | ||
----- | ||
Requirements for your platform | ||
- Linux: xclip, or xsel (with gtk or PyQt4 modules) | ||
- Windows: none | ||
- OS X: none | ||
Requirements for your platform. | ||
- Linux : `xclip`, or `xsel` (with `gtk` or `PyQt4` modules) | ||
- Windows : none | ||
- OS X : none | ||
|
||
Examples | ||
-------- | ||
Copy the contents of a DataFrame to the clipboard. | ||
|
||
>>> 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 commentThe reason will be displayed to describe this comment to others. Learn more. backticks for "index" instead of quotes |
||
it to false. | ||
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. Remove the leading space here. |
||
|
||
>>> df.to_clipboard(index=False) | ||
""" | ||
from pandas.io import clipboards | ||
clipboards.to_clipboard(self, excel=excel, sep=sep, **kwargs) | ||
|
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