zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
U
¬ý°dçã@s°dZddlmZddlmZddlmZddlZddlm    Z    ddl
m Z ddl m Z dd    lmZdd
lmZmZer€dd lmZd e    jfd ddœdd„Zdddddœdd„ZdS)z io on the clipboard é)Ú annotations)ÚStringIO)Ú TYPE_CHECKINGN)Úlib)Úfind_stack_level)Úcheck_dtype_backend)Ú ABCDataFrame)Ú
get_optionÚoption_context)Ú DtypeBackendú\s+ÚstrzDtypeBackend | lib.NoDefault©ÚsepÚ dtype_backendc
Ks°| dd¡}|dk    r0| ¡ dd¡dkr0tdƒ‚t|ƒdd    lm}dd
lm}|ƒ}z|     | 
d¡plt d ƒ¡}Wnt k
r†YnX|dd …  d ¡dd…dd…}dd„|Dƒ}t|ƒdkr"t|ƒdkr"| ¡dkr"d}t|dƒt|d d¡ƒ}    |    dkr"| dtt|    ƒƒ¡|dkr@| 
d¡dkr@d}t|ƒdkrh| 
d¡dkrhd|d<n.t|ƒdkr–| 
d¡dkr–tjdtƒd|t|ƒf||dœ|—ŽS)a#
    Read text from clipboard and pass to read_csv.
 
    Parameters
    ----------
    sep : str, default '\s+'
        A string or regex delimiter. The default of '\s+' denotes
        one or more whitespace characters.
 
    dtype_backend : {"numpy_nullable", "pyarrow"}, defaults to NumPy backed DataFrames
        Which dtype_backend to use, e.g. whether a DataFrame should have NumPy
        arrays, nullable dtypes are used for all dtypes that have a nullable
        implementation when "numpy_nullable" is set, pyarrow is used for all
        dtypes if "pyarrow" is set.
 
        The dtype_backends are still experimential.
 
        .. versionadded:: 2.0
 
    **kwargs
        See read_csv for the full argument list.
 
    Returns
    -------
    DataFrame
        A parsed DataFrame object.
    Úencodingúutf-8Nú-ÚÚutf8z3reading from clipboard only supports utf-8 encodingr)Ú clipboard_get)Úread_csvzdisplay.encodingi'Ú
éÿÿÿÿé
cSsh|]}| d¡ d¡’qS)ú ú    )ÚlstripÚcount)Ú.0Úx©r!úKd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/io/clipboards.pyÚ    <setcomp>Wsz!read_clipboard.<locals>.<setcomp>érz     Z    index_colZdelim_whitespacer ZengineÚpythonÚczIread_clipboard with regex separator does not work properly with c engine.©Ú
stacklevelr)ÚpopÚlowerÚreplaceÚNotImplementedErrorrÚpandas.io.clipboardrZpandas.io.parsersrÚdecodeÚgetr    ÚAttributeErrorÚsplitÚlenrÚ
setdefaultÚlistÚrangeÚwarningsÚwarnrr)
rrÚkwargsrrrÚtextÚlinesÚcountsZ index_lengthr!r!r"Úread_clipboards8    "*
 
þr<Tz bool | Nonez
str | NoneÚNone)ÚexcelrÚreturnc        Ks| dd¡}|dk    r0| ¡ dd¡dkr0tdƒ‚dd    lm}|dkrHd
}|r´z@|dkrZd }tƒ}|j|f|dd œ|—Ž| ¡}||ƒWdSt    k
r°t
j d t ƒdYqÌXn|dk    rÌt
j dt ƒdt |tƒrútddƒ|jf|Ž}W5QRXnt|ƒ}||ƒdS)a®
    Attempt to write text representation of object to the system clipboard
    The clipboard can be then pasted into Excel for example.
 
    Parameters
    ----------
    obj : the object to write to the clipboard
    excel : bool, 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
 
    Notes
    -----
    Requirements for your platform
      - Linux: xclip, or xsel (with PyQt4 modules)
      - Windows:
      - OS X:
    rrNrrrz&clipboard only supports utf-8 encodingr)Ú clipboard_setTr)rrzAto_clipboard in excel mode requires a single character separator.r'z7to_clipboard with excel=False ignores the sep argument.zdisplay.max_colwidth)r)r*r+Ú
ValueErrorr-r@rZto_csvÚgetvalueÚ    TypeErrorr6r7rÚ
isinstancerr
Z    to_stringr )    Úobjr>rr8rr@Úbufr9Zobjstrr!r!r"Ú to_clipboardqs<  þþ
 rG)TN)Ú__doc__Ú
__future__rÚiorÚtypingrr6Z pandas._libsrZpandas.util._exceptionsrZpandas.util._validatorsrZpandas.core.dtypes.genericrZpandasr    r
Zpandas._typingr Z
no_defaultr<rGr!r!r!r"Ú<module>s"        þ[ÿ