Skip to content

Commit ab273f6

Browse files
committed
Added documentation for to_clipboard()
1 parent 58642a6 commit ab273f6

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

doc/source/io.rst

+31
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,37 @@ And then import the data directly to a DataFrame by calling:
12311231
12321232
clipdf
12331233
1234+
.. note::
1235+
1236+
You may need to install xsel on Linux to be able to read from the clipboard.
1237+
1238+
The ``to_clipboard`` method can be used to write the contents of a DataFrame to
1239+
the clipboard. Following which you can paste the clipboard contents into other
1240+
applications (CTRL-V on many operating systems). Here we illustrate writing a
1241+
DataFrame into clipboard and reading it back.
1242+
1243+
.. ipython:: python
1244+
1245+
df=pd.DataFrame(randn(5,3))
1246+
1247+
.. ipython:: python
1248+
1249+
df
1250+
1251+
.. ipython:: python
1252+
1253+
df.to_clipboard()
1254+
1255+
.. ipython:: python
1256+
1257+
obj=pd.read_clipboard()
1258+
1259+
.. ipython:: python
1260+
1261+
obj
1262+
1263+
1264+
12341265
12351266
.. _io.excel:
12361267

0 commit comments

Comments
 (0)