§
    Ñ! h‹D  ã                  óB  — d dl mZ d dlmZmZ d dlZd dlmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZ d dlZd d	lmZmZ d d
lmZ d dlmZmZ d dlmZmZmZmZ d dlm Z m!Z!m"Z" erd dlm#Z# ej$        ej%        ej&        ej'        ej(        ej)        ej)        dœZ*ej&        ej+        dfej)        ej,        e
fej$        ej-        dfej%        ej-        dfej'        ej-        dfej.        ej,        dfej(        ej/        d fiZ0ej-        dej+        dej,        diZ1 G d„ de¦  «        Z2dS )é    )Úannotations)ÚTYPE_CHECKINGÚAnyN)Úinfer_dtype)ÚiNaT)ÚNoBufferPresent)Úcache_readonly)ÚBaseMaskedDtype)Ú
ArrowDtypeÚDatetimeTZDtype)Úis_string_dtype)ÚPandasBufferÚPandasBufferPyarrow)ÚColumnÚColumnBuffersÚColumnNullTypeÚ	DtypeKind)ÚArrowCTypesÚ
EndiannessÚdtype_to_arrow_c_fmt)ÚBuffer)ÚiÚuÚfÚbÚUÚMÚméÿÿÿÿzThis column is non-nullablezThis column uses NaN as nullz!This column uses a sentinel valuec                  óê   — e Zd ZdZd"d#d	„Zd$d„Zed$d„¦   «         Zed%d„¦   «         Z	d%d„Z
ed„ ¦   «         Zed„ ¦   «         Zed$d„¦   «         Zed&d„¦   «         Zd$d„Zd'd(d„Zd)d„Zd*d„Zd+d„Zd,d!„ZdS )-ÚPandasColumnaö  
    A column object, with only the methods and properties required by the
    interchange protocol defined.
    A column can contain one or more chunks. Each chunk can contain up to three
    buffers - a data buffer, a mask buffer (depending on null representation),
    and an offsets buffer (if variable-size binary; e.g., variable-length
    strings).
    Note: this Column object can only be produced by ``__dataframe__``, so
          doesn't need its own version or ``__column__`` protocol.
    TÚcolumnú	pd.SeriesÚ
allow_copyÚboolÚreturnÚNonec                óú   — t          |t          j        ¦  «        rt          d|j        › d�¦  «        ‚t          |t          j        ¦  «        s t          dt          |¦  «        › d�¦  «        ‚|| _        || _	        dS )zu
        Note: doesn't deal with extension arrays yet, just assume a regular
        Series/ndarray for now.
        z·Expected a Series, got a DataFrame. This likely happened because you called __dataframe__ on a DataFrame which, after converting column names to string, resulted in duplicated names: zD. Please rename these columns before using the interchange protocol.zColumns of type ú not handled yetN)
Ú
isinstanceÚpdÚ	DataFrameÚ	TypeErrorÚcolumnsÚSeriesÚNotImplementedErrorÚtypeÚ_colÚ_allow_copy)Úselfr"   r$   s      úXc:\xampp_lite_8_4\www\timesheet\venv\Lib\site-packages\pandas/core/interchange/column.pyÚ__init__zPandasColumn.__init__T   s“   € õ
 �f�bœlÑ+Ô+ð 	Ýð2ð !œ.ð2ð 2ð 2ñô ð õ ˜&¥"¤)Ñ,Ô,ð 	YÝ%Ð&W½¸f¹¼Ð&WÐ&WÐ&WÑXÔXÐXð ˆŒ	Ø%ˆÔÐÐó    Úintc                ó   — | j         j        S )z2
        Size of the column, in elements.
        )r2   Úsize©r4   s    r5   r:   zPandasColumn.sizeh   s   € ð ŒyŒ~Ðr7   c                ó   — dS )z7
        Offset of first element. Always zero.
        r   © r;   s    r5   ÚoffsetzPandasColumn.offsetn   s	   € ð ˆqr7   útuple[DtypeKind, int, str, str]c                óÂ  — | j         j        }t          |t          j        ¦  «        rJ| j         j        j        }|                      |j        ¦  «        \  }}}}t          j	        ||t          j        fS t          |¦  «        rLt          | j         ¦  «        dv r't          j        dt          |¦  «        t          j        fS t!          d¦  «        ‚|                      |¦  «        S )N)ÚstringÚemptyé   z.Non-string object dtypes are not supported yet)r2   Údtyper*   r+   ÚCategoricalDtypeÚvaluesÚcodesÚ_dtype_from_pandasdtyper   ÚCATEGORICALr   ÚNATIVEr   r   ÚSTRINGr   r0   )r4   rD   rG   Ú_ÚbitwidthÚc_arrow_dtype_f_strs         r5   rD   zPandasColumn.dtypev   sâ   € à”	”ˆå�e�RÔ0Ñ1Ô1ð 	7Ø”IÔ$Ô*ˆEð ×,Ò,¨U¬[Ñ9Ô9ñØØØ#Øõ Ô%ØØ#ÝÔ!ð	ð õ ˜UÑ#Ô#ð 
	7Ý˜4œ9Ñ%Ô%Ð)<Ð<Ð<åÔ$ØÝ(¨Ñ/Ô/ÝÔ%ð	ð õ &Ð&VÑWÔWÐWà×/Ò/°Ñ6Ô6Ð6r7   c                ó²  — t                                |j        d¦  «        }|€t          d|› d�¦  «        ‚t	          |t
          ¦  «        r|j        j        }nKt	          |t          ¦  «        r|j	        j        }n)t	          |t          ¦  «        r|j        j        }n|j        }|dk    r||j        t          j        |fS ||j        dz  t          |¦  «        |fS )z/
        See `self.dtype` for details.
        Nú
Data type z& not supported by interchange protocolzbool[pyarrow]rC   )Ú	_NP_KINDSÚgetÚkindÚ
ValueErrorr*   r   Únumpy_dtypeÚ	byteorderr   Úbaser
   Úitemsizer   ÚBOOLr   )r4   rD   rS   rV   s       r5   rH   z$PandasColumn._dtype_from_pandasdtype”   sä   € õ �}Š}˜UœZ¨Ñ.Ô.ˆØˆ<åÐW¨%ÐWÐWÐWÑXÔXÐXÝ�e�ZÑ(Ô(ð 	(ØÔ)Ô3ˆIˆIÝ˜�Ñ/Ô/ð 	(Øœ
Ô,ˆIˆIÝ˜�Ñ/Ô/ð 	(ØÔ)Ô3ˆIˆIàœˆIà�OÒ#Ð#ð Ø”ÝÔ Øð	ð ð �U”^ aÑ'Õ)=¸eÑ)DÔ)DÀiÐOÐOr7   c                óÜ   — | j         d         t          j        k    st          d¦  «        ‚| j        j        j        dt          t          j	        | j        j        j
        ¦  «        ¦  «        dœS )a:  
        If the dtype is categorical, there are two options:
        - There are only values in the data buffer.
        - There is a separate non-categorical Column encoding for categorical values.

        Raises TypeError if the dtype is not categorical

        Content of returned dict:
            - "is_ordered" : bool, whether the ordering of dictionary indices is
                             semantically meaningful.
            - "is_dictionary" : bool, whether a dictionary-style mapping of
                                categorical values to other objects exists
            - "categories" : Column representing the (implicit) mapping of indices to
                             category values (e.g. an array of cat1, cat2, ...).
                             None if not a dictionary-style categorical.
        r   zCdescribe_categorical only works on a column with categorical dtype!T)Ú
is_orderedÚis_dictionaryÚ
categories)rD   r   rI   r-   r2   ÚcatÚorderedr!   r+   r/   r]   r;   s    r5   Údescribe_categoricalz!PandasColumn.describe_categoricalµ   sg   € ð$ Œz˜!Œ}¥	Ô 5Ò5Ð5ÝØUñô ð ð
 œ)œ-Ô/Ø!Ý&¥r¤y°´´Ô1IÑ'JÔ'JÑKÔKð
ð 
ð 	
r7   c                óÊ  — t          | j        j        t          ¦  «        rt          j        }d}||fS t          | j        j        t          ¦  «        rP| j        j        j        j	        d          
                    ¦   «         d         €t          j        d fS t          j        dfS | j        d         }	 t          |         \  }}n!# t          $ r t          d|› d�¦  «        ‚w xY w||fS )Né   r   rP   z not yet supported)r*   r2   rD   r
   r   ÚUSE_BYTEMASKr   ÚarrayÚ	_pa_arrayÚchunksÚbuffersÚNON_NULLABLEÚUSE_BITMASKÚ_NULL_DESCRIPTIONÚKeyErrorr0   )r4   Úcolumn_null_dtypeÚ
null_valuerS   ÚnullÚvalues         r5   Údescribe_nullzPandasColumn.describe_nullÒ   sñ   € å�d”i”o¥Ñ7Ô7ð 	1Ý .Ô ;ÐØˆJØ$ jÐ0Ð0Ý�d”i”o¥zÑ2Ô2ð 	1ð ŒyŒÔ(Ô/°Ô2×:Ò:Ñ<Ô<¸QÔ?ÐGÝ%Ô2°DÐ8Ð8Ý!Ô-¨qÐ0Ð0ØŒz˜!Œ}ˆð	MÝ+¨DÔ1‰KˆD�%�%øÝð 	Mð 	Mð 	MÝ%Ð&K°4Ð&KÐ&KÐ&KÑLÔLÐLð	Møøøð �Uˆ{Ðs   Â/C  Ã Cc                ó|   — | j                              ¦   «                              ¦   «                              ¦   «         S )zB
        Number of null elements. Should always be known.
        )r2   ÚisnaÚsumÚitemr;   s    r5   Ú
null_countzPandasColumn.null_countæ   s.   € ð
 Œy�~Š~ÑÔ×#Ò#Ñ%Ô%×*Ò*Ñ,Ô,Ð,r7   údict[str, pd.Index]c                ó   — d| j         j        iS )z8
        Store specific metadata of the column.
        zpandas.index)r2   Úindexr;   s    r5   ÚmetadatazPandasColumn.metadataí   s   € ð
  ¤	¤Ð0Ð0r7   c                ó   — dS )zE
        Return the number of chunks the column consists of.
        rb   r=   r;   s    r5   Ú
num_chunkszPandasColumn.num_chunksô   s	   € ð ˆqr7   NÚn_chunksú
int | Nonec              #  óú   K  — |rr|dk    rlt          | j        ¦  «        }||z  }||z  dk    r|dz  }t          d||z  |¦  «        D ].}t          | j        j        |||z   …         | j        ¦  «        V — Œ/dS | V — dS )zy
        Return an iterator yielding the chunks.
        See `DataFrame.get_chunks` for details on ``n_chunks``.
        rb   r   N)Úlenr2   Úranger!   Úilocr3   )r4   r|   r:   ÚstepÚstarts        r5   Ú
get_chunkszPandasColumn.get_chunksú   sº   è è € ð
 ð 
	˜ 1š˜Ý�t”y‘>”>ˆDØ˜8Ñ#ˆDØ�h‰ !Ò#Ð#Ø˜‘	�Ý˜q $¨¡/°4Ñ8Ô8ð ð �Ý"Ø”I”N 5¨5°4©<Ð#7Ô8¸$Ô:Jñô ð ð ð ð ðð ð
 ˆJˆJˆJˆJˆJr7   r   c                óÚ   — |                       ¦   «         dddœ}	 |                      ¦   «         |d<   n# t          $ r Y nw xY w	 |                      ¦   «         |d<   n# t          $ r Y nw xY w|S )a`  
        Return a dictionary containing the underlying buffers.
        The returned dictionary has the following contents:
            - "data": a two-element tuple whose first element is a buffer
                      containing the data and whose second element is the data
                      buffer's associated dtype.
            - "validity": a two-element tuple whose first element is a buffer
                          containing mask values indicating missing data and
                          whose second element is the mask value buffer's
                          associated dtype. None if the null representation is
                          not a bit or byte mask.
            - "offsets": a two-element tuple whose first element is a buffer
                         containing the offset values for variable-size binary
                         data (e.g., variable-length strings) and whose second
                         element is the offsets buffer's associated dtype. None
                         if the data buffer does not have an associated offsets
                         buffer.
        N)ÚdataÚvalidityÚoffsetsr‡   rˆ   )Ú_get_data_bufferÚ_get_validity_bufferr   Ú_get_offsets_buffer)r4   rg   s     r5   Úget_bufferszPandasColumn.get_buffers  s¨   € ð( ×)Ò)Ñ+Ô+ØØð"
ð "
ˆð	Ø"&×";Ò";Ñ"=Ô"=ˆG�JÑÐøÝð 	ð 	ð 	ØˆDð	øøøð	Ø!%×!9Ò!9Ñ!;Ô!;ˆG�IÑÐøÝð 	ð 	ð 	ØˆDð	øøøð ˆs   š2 ²
?¾?ÁA Á
A(Á'A(ú.tuple[Buffer, tuple[DtypeKind, int, str, str]]c                óJ  — | j         d         t          j        t          j        t          j        t          j        t          j        fv �r/| j         }| j         d         t          j        k    rPt          | j         d         ¦  «        dk    r2| j        j	         
                    d¦  «                             ¦   «         }n¥| j        j        }t          | j        j         t          ¦  «        r|j        }nrt          | j        j         t           ¦  «        rL|j        j        d         }t'          |                     ¦   «         d         t          |¦  «        ¬¦  «        }||fS |j        }t-          || j        ¬¦  «        }�n*| j         d         t          j        k    rB| j        j        j        }t-          || j        ¬¦  «        }|                      |j         ¦  «        }nÍ| j         d         t          j        k    r•| j                             ¦   «         }t;          ¦   «         }|D ]@}t          |t<          ¦  «        r)|                     |                      d¬	¦  «        ¦  «         ŒAt-          tC          j"        |d
¬¦  «        ¦  «        }| j         }ntG          d| j        j         › d�¦  «        ‚||fS )zZ
        Return the buffer containing the data and the buffer's associated dtype.
        r   é   é   Nrb   ©Úlength)r$   úutf-8©ÚencodingÚuint8)rD   rP   r)   )$rD   r   ÚINTÚUINTÚFLOATrY   ÚDATETIMEr   r2   ÚdtÚ
tz_convertÚto_numpyrd   r*   r
   Ú_datar   re   rf   r   rg   Ú_ndarrayr   r3   rI   rF   Ú_codesrH   rK   Ú	bytearrayÚstrÚextendÚencodeÚnpÚ
frombufferr0   )	r4   rD   Únp_arrÚarrÚbufferrG   Úbufr   Úobjs	            r5   r‰   zPandasColumn._get_data_buffer0  sH  € ð Œ:�aŒ=ÝŒMÝŒNÝŒOÝŒNÝÔð
ð 
ñ 
ð ”JˆEØŒz˜!Œ}¥	Ô 2Ò2Ð2µs¸4¼:Àa¼=Ñ7IÔ7IÈAÒ7MÐ7MØœœ×0Ò0°Ñ6Ô6×?Ò?ÑAÔA��à”i”o�Ý˜dœiœo­Ñ?Ô?ð *Ø œY�F�FÝ ¤	¤µÑ<Ô<ð 
*ð œ-Ô.¨qÔ1�CÝ0ØŸš™œ aÔ(Ý" 3™xœxðñ ô �Fð " 5˜=Ð(à œ\�FÝ! &°TÔ5EÐFÑFÔFˆF‰FØŒZ˜Œ]�iÔ3Ò3Ð3Ø”IÔ$Ô+ˆEÝ! %°DÔ4DÐEÑEÔEˆFØ×0Ò0°´Ñ=Ô=ˆEˆEØŒZ˜Œ]�iÔ.Ò.Ð.à”)×$Ò$Ñ&Ô&ˆCÝ‘”ˆAð ð ;ð ;�Ý˜c¥3Ñ'Ô'ð ;Ø—H’H˜SŸZšZ°˜ZÑ9Ô9Ñ:Ô:Ð:øõ "¥"¤-°¸Ð"AÑ"AÔ"AÑBÔBˆFð
 ”JˆEˆEå%Ð&T°4´9´?Ð&TÐ&TÐ&TÑUÔUÐUà�uˆ}Ðr7   útuple[Buffer, Any] | Nonec                óp  — | j         \  }}t          | j        j        t          ¦  «        r–| j        j        j        j        d         }t          j	        dt          j	        t          j        f}|                     ¦   «         d         €dS t          |                     ¦   «         d         t          |¦  «        ¬¦  «        }||fS t          | j        j        t           ¦  «        rH| j        j        j        }t%          |¦  «        }t          j	        dt          j	        t          j        f}||fS | j        d         t          j        k    r¸| j                             ¦   «         }|dk    }| }t+          j        t          |¦  «        ft*          j        ¬¦  «        }t1          |¦  «        D ]!\  }	}
t          |
t2          ¦  «        r|n|||	<   Œ"t%          |¦  «        }t          j	        dt          j	        t          j        f}||fS 	 t4          |         › d�}n# t6          $ r t9          d¦  «        ‚w xY wt;          |¦  «        ‚)	zÒ
        Return the buffer containing the mask values indicating missing data and
        the buffer's associated dtype.
        Raises NoBufferPresent if null representation is not a bit or byte mask.
        r   rb   Nr‘   rC   ©ÚshaperD   z! so does not have a separate maskzSee self.describe_null)rp   r*   r2   rD   r   rd   re   rf   r   rY   r   r   rJ   rg   r   r   r
   Ú_maskr   rK   r�   r¥   ÚzerosÚbool_Ú	enumerater¢   Ú_NO_VALIDITY_BUFFERrk   r0   r   )r4   rn   Úinvalidr¨   rD   r©   Úmaskrª   Úvalidr   r«   Úmsgs               r5   rŠ   z!PandasColumn._get_validity_buffern  s  € ð Ô*‰ˆˆgå�d”i”o¥zÑ2Ô2ð 	!ð ”)”/Ô+Ô2°1Ô5ˆCÝ”^ Q­Ô(8½*Ô:KÐLˆEØ�{Š{‰}Œ}˜QÔÐ'Ø�tÝ(Ø—’‘”˜aÔ Ý˜3‘x”xðñ ô ˆFð ˜5�=Ð å�d”i”o¥Ñ7Ô7ð 	!Ø”9”?Ô(ˆDÝ! $Ñ'Ô'ˆFÝ”^ Q­Ô(8½*Ô:KÐLˆEØ˜5�=Ð àŒ:�aŒ=�IÔ,Ò,Ð,ð ”)×$Ò$Ñ&Ô&ˆCð ˜q’LˆEØ�iˆGå”8¥3 s¡8¤8 +µR´XÐ>Ñ>Ô>ˆDÝ# C™.œ.ð Eð E‘��3Ý#-¨cµ3Ñ#7Ô#7ÐD˜%˜%¸W��Q‘�õ " $Ñ'Ô'ˆFõ ”^ Q­Ô(8½*Ô:KÐLˆEà˜5�=Ð ð	@Ý(¨Ô.ÐQÐQÐQˆCˆCøÝð 	@ð 	@ð 	@å%Ð&>Ñ?Ô?Ð?ð	@øøøõ ˜cÑ"Ô"Ð"s   Ç;H ÈH&útuple[PandasBuffer, Any]c                ó  — | j         d         t          j        k    rÚ| j                             ¦   «         }d}t          j        t          |¦  «        dz   ft
          j        ¬¦  «        }t          |¦  «        D ]J\  }}t          |t          ¦  «        r(|                     d¬¦  «        }|t          |¦  «        z  }|||dz   <   ŒKt          |¦  «        }t          j        dt          j        t"          j        f}nt'          d¦  «        ‚||fS )a  
        Return the buffer containing the offset values for variable-size binary
        data (e.g., variable-length strings) and the buffer's associated dtype.
        Raises NoBufferPresent if the data buffer does not have an associated
        offsets buffer.
        r   rb   r®   r“   r”   é@   zJThis column has a fixed-length dtype so it does not have an offsets buffer)rD   r   rK   r2   r�   r¥   r±   r   Úint64r³   r*   r¢   r¤   r   r—   r   ÚINT64r   rJ   r   )	r4   rF   Úptrrˆ   r   Úvr   r©   rD   s	            r5   r‹   z PandasColumn._get_offsets_buffer§  s  € ð Œ:�aŒ=�IÔ,Ò,Ð,à”Y×'Ò'Ñ)Ô)ˆFØˆCÝ”h¥c¨&¡k¤k°A¡oÐ%7½r¼xÐHÑHÔHˆGÝ! &Ñ)Ô)ð %ð %‘��1õ ˜a¥Ñ%Ô%ð "ØŸš¨'˜Ñ2Ô2�AØ�3˜q™6œ6‘M�Cà!$�˜˜A™‘�õ " 'Ñ*Ô*ˆFõ ”ØÝÔ!ÝÔ!ð	ˆEˆEõ "ð5ñô ð ð
 �uˆ}Ðr7   )T)r"   r#   r$   r%   r&   r'   )r&   r8   )r&   r?   )r&   rv   )N)r|   r}   )r&   r   )r&   r�   )r&   r¬   )r&   r¹   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r6   r:   Úpropertyr>   r	   rD   rH   r`   rp   ru   ry   r{   r„   rŒ   r‰   rŠ   r‹   r=   r7   r5   r!   r!   H   sš  € € € € € ð	ð 	ð&ð &ð &ð &ð &ð(ð ð ð ð ðð ð ñ „Xðð ð7ð 7ð 7ñ „^ð7ð:Pð Pð Pð PðB ð
ð 
ñ „Xð
ð8 ðð ñ „Xðð& ð-ð -ð -ñ „^ð-ð ð1ð 1ð 1ñ „Xð1ðð ð ð ðð ð ð ð ð"#ð #ð #ð #ðJ<ð <ð <ð <ð|7#ð 7#ð 7#ð 7#ðr&ð &ð &ð &ð &ð &r7   r!   )3Ú
__future__r   Útypingr   r   Únumpyr¥   Úpandas._libs.libr   Úpandas._libs.tslibsr   Úpandas.errorsr   Úpandas.util._decoratorsr	   Úpandas.core.dtypes.dtypesr
   Úpandasr+   r   r   Úpandas.api.typesr   Úpandas.core.interchange.bufferr   r   Ú*pandas.core.interchange.dataframe_protocolr   r   r   r   Úpandas.core.interchange.utilsr   r   r   r   r—   r˜   r™   rY   rK   rš   rQ   ÚUSE_NANÚUSE_SENTINELrh   rI   rc   rj   r´   r!   r=   r7   r5   ú<module>rÔ      s±  ðØ "Ð "Ð "Ð "Ð "Ð "ðð ð ð ð ð ð ð ð
 Ð Ð Ð à (Ð (Ð (Ð (Ð (Ð (Ø $Ð $Ð $Ð $Ð $Ð $Ø )Ð )Ð )Ð )Ð )Ð )Ø 2Ð 2Ð 2Ð 2Ð 2Ð 2à 5Ð 5Ð 5Ð 5Ð 5Ð 5à Ð Ð Ð ðð ð ð ð ð ð ð ð -Ð ,Ð ,Ð ,Ð ,Ð ,ðð ð ð ð ð ð ð ðð ð ð ð ð ð ð ð ð ð ð ðð ð ð ð ð ð ð ð ð ð ð BØAÐAÐAÐAÐAÐAð 
ŒØ	ŒØ	ŒØ	ŒØ	Ô	Ø	Ô	Ø	Ô	ðð €	ð „O�nÔ,¨dÐ3ØÔ˜Ô4°dÐ;Ø„M�NÔ/°Ð6Ø„N�^Ô0°$Ð7Ø„N�^Ô0°$Ð7ð Ô˜NÔ7¸Ð<àÔ�~Ô2°AÐ6ðÐ ð ÔÐ!>ØÔÐ:ØÔÐ!DðÐ ðEð Eð Eð Eð E�6ñ Eô Eð Eð Eð Er7   