pandas.read_clipboard#
- pandas.read_clipboard(sep='\\s+', dtype_backend=<no_default>, **kwargs)[source]#
Read text from clipboard and pass to
read_csv()
.Parses clipboard contents similar to how CSV files are parsed using
read_csv()
.- Parameters:
- sepstr, default ‘\s+’
A string or regex delimiter. The default of
'\\s+'
denotes one or more whitespace characters.- dtype_backend{‘numpy_nullable’, ‘pyarrow’}, default ‘numpy_nullable’
Back-end data type applied to the resultant
DataFrame
(still experimental). Behaviour is as follows:"numpy_nullable"
: returns nullable-dtype-backedDataFrame
(default)."pyarrow"
: returns pyarrow-backed nullableArrowDtype
DataFrame.
Added in version 2.0.
- **kwargs
See
read_csv()
for the full argument list.
- Returns:
- DataFrame
A parsed
DataFrame
object.
See also
DataFrame.to_clipboard
Copy object to the system clipboard.
read_csv
Read a comma-separated values (csv) file into DataFrame.
read_fwf
Read a table of fixed-width formatted lines into DataFrame.
Examples
>>> df = pd.DataFrame([[1, 2, 3], [4, 5, 6]], columns=['A', 'B', 'C']) >>> df.to_clipboard() >>> pd.read_clipboard() A B C 0 1 2 3 1 4 5 6