DataFrame.
to_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.
Produce output in a csv format for easy pasting into excel.
True, use the provided separator for csv pasting.
False, write a string representation of the object to the clipboard.
'\t'
Field delimiter.
These parameters will be passed to DataFrame.to_csv.
See also
DataFrame.to_csv
Write a DataFrame to a comma-separated values (csv) file.
read_clipboard
Read text from clipboard and pass to read_table.
Notes
Requirements for your platform.
Linux : xclip, or xsel (with PyQt4 modules) Windows : none OS X : none
Linux : xclip, or xsel (with 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(sep=',') ... # Wrote the following to the system clipboard: ... # ,A,B,C ... # 0,1,2,3 ... # 1,4,5,6
We can omit the index by passing the keyword index and setting it to false.
>>> df.to_clipboard(sep=',', index=False) ... # Wrote the following to the system clipboard: ... # A,B,C ... # 1,2,3 ... # 4,5,6