a
    OªfF  ã                   @  sŽ  U d dl mZ d dlmZ d dlZd dlmZ d dlm	Z	 d dl
mZmZ G dd„ deƒZG d	d
„ d
eƒZdZeG dd„ deƒƒZeG dd„ deƒƒZeG dd„ deƒƒZeG dd„ deƒƒZeG dd„ deƒƒZeG dd„ deƒƒZeG dd„ deƒƒZeG dd„ deƒƒZe ej¡eƒ e ej¡eƒ e ej¡eƒ e ej¡eƒ e ej¡eƒ e ej¡eƒ e ej¡eƒ e ej ¡eƒ iZ!de"d< dS )é    )Úannotations)ÚClassVarN)Úregister_extension_dtype)Úis_integer_dtype)ÚNumericArrayÚNumericDtypec                   @  s\   e Zd ZdZe ej¡ZeZ	e
ddœdd„ƒZe
ddœdd„ƒZe
d	d
dd	dœdd„ƒZdS )ÚIntegerDtypea'  
    An ExtensionDtype to hold a single size & kind of integer dtype.

    These specific implementations are subclasses of the non-public
    IntegerDtype. For example, we have Int8Dtype to represent signed int 8s.

    The attributes name & type are set when these subclasses are created.
    ztype[IntegerArray])Úreturnc                 C  s   t S )zq
        Return the array type associated with this dtype.

        Returns
        -------
        type
        )ÚIntegerArray©Úcls© r   úS/var/www/ai-form-bot/venv/lib/python3.9/site-packages/pandas/core/arrays/integer.pyÚconstruct_array_type   s    	z!IntegerDtype.construct_array_typeúdict[np.dtype, IntegerDtype]c                 C  s   t S )N)ÚNUMPY_INT_TO_DTYPEr   r   r   r   Ú_get_dtype_mapping(   s    zIntegerDtype._get_dtype_mappingz
np.ndarrayznp.dtypeÚbool)ÚvaluesÚdtypeÚcopyr	   c              
   C  s„   z|j |d|dW S  ty~ } zT|j ||d}||k ¡ rL|W  Y d}~S td|j› dt |¡› ƒ|‚W Y d}~n
d}~0 0 dS )zÉ
        Safely cast the values to the given dtype.

        "safe" in this context means the casting is lossless. e.g. if 'values'
        has a floating dtype, each value must be an integer.
        Úsafe)Zcastingr   )r   Nz"cannot safely cast non-equivalent z to )ZastypeÚ	TypeErrorÚallr   Únp)r   r   r   r   ÚerrZcastedr   r   r   Ú
_safe_cast,   s    ÿþzIntegerDtype._safe_castN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Úint64Z_default_np_dtyper   Z_checkerÚclassmethodr   r   r   r   r   r   r   r      s   	
r   c                   @  s    e Zd ZdZeZdZdZdZdS )r
   aó  
    Array of integer (optional missing) values.

    Uses :attr:`pandas.NA` as the missing value.

    .. warning::

       IntegerArray is currently experimental, and its API or internal
       implementation may change without warning.

    We represent an IntegerArray with 2 numpy arrays:

    - data: contains a numpy integer array of the appropriate dtype
    - mask: a boolean array holding a mask on the data, True is missing

    To construct an IntegerArray from generic array-like input, use
    :func:`pandas.array` with one of the integer dtypes (see examples).

    See :ref:`integer_na` for more.

    Parameters
    ----------
    values : numpy.ndarray
        A 1-d integer-dtype array.
    mask : numpy.ndarray
        A 1-d boolean-dtype array indicating missing values.
    copy : bool, default False
        Whether to copy the `values` and `mask`.

    Attributes
    ----------
    None

    Methods
    -------
    None

    Returns
    -------
    IntegerArray

    Examples
    --------
    Create an IntegerArray with :func:`pandas.array`.

    >>> int_array = pd.array([1, None, 3], dtype=pd.Int32Dtype())
    >>> int_array
    <IntegerArray>
    [1, <NA>, 3]
    Length: 3, dtype: Int32

    String aliases for the dtypes are also available. They are capitalized.

    >>> pd.array([1, None, 3], dtype='Int32')
    <IntegerArray>
    [1, <NA>, 3]
    Length: 3, dtype: Int32

    >>> pd.array([1, None, 3], dtype='UInt16')
    <IntegerArray>
    [1, <NA>, 3]
    Length: 3, dtype: UInt16
    é   r   N)	r   r   r   r    r   Z
_dtype_clsZ_internal_fill_valueZ_truthy_valueZ_falsey_valuer   r   r   r   r
   @   s
   @r
   aä  
An ExtensionDtype for {dtype} integer data.

Uses :attr:`pandas.NA` as its missing value, rather than :attr:`numpy.nan`.

Attributes
----------
None

Methods
-------
None

Examples
--------
For Int8Dtype:

>>> ser = pd.Series([2, pd.NA], dtype=pd.Int8Dtype())
>>> ser.dtype
Int8Dtype()

For Int16Dtype:

>>> ser = pd.Series([2, pd.NA], dtype=pd.Int16Dtype())
>>> ser.dtype
Int16Dtype()

For Int32Dtype:

>>> ser = pd.Series([2, pd.NA], dtype=pd.Int32Dtype())
>>> ser.dtype
Int32Dtype()

For Int64Dtype:

>>> ser = pd.Series([2, pd.NA], dtype=pd.Int64Dtype())
>>> ser.dtype
Int64Dtype()

For UInt8Dtype:

>>> ser = pd.Series([2, pd.NA], dtype=pd.UInt8Dtype())
>>> ser.dtype
UInt8Dtype()

For UInt16Dtype:

>>> ser = pd.Series([2, pd.NA], dtype=pd.UInt16Dtype())
>>> ser.dtype
UInt16Dtype()

For UInt32Dtype:

>>> ser = pd.Series([2, pd.NA], dtype=pd.UInt32Dtype())
>>> ser.dtype
UInt32Dtype()

For UInt64Dtype:

>>> ser = pd.Series([2, pd.NA], dtype=pd.UInt64Dtype())
>>> ser.dtype
UInt64Dtype()
c                   @  s,   e Zd ZU ejZdZded< ej	ddZ
dS )Ú	Int8DtypeZInt8úClassVar[str]ÚnameÚint8©r   N)r   r   r   r   r'   Útyper&   Ú__annotations__Ú_dtype_docstringÚformatr    r   r   r   r   r$   Ï   s   
r$   c                   @  s,   e Zd ZU ejZdZded< ej	ddZ
dS )Ú
Int16DtypeZInt16r%   r&   Úint16r(   N)r   r   r   r   r.   r)   r&   r*   r+   r,   r    r   r   r   r   r-   Ö   s   
r-   c                   @  s,   e Zd ZU ejZdZded< ej	ddZ
dS )Ú
Int32DtypeZInt32r%   r&   Úint32r(   N)r   r   r   r   r0   r)   r&   r*   r+   r,   r    r   r   r   r   r/   Ý   s   
r/   c                   @  s,   e Zd ZU ejZdZded< ej	ddZ
dS )Ú
Int64DtypeZInt64r%   r&   r!   r(   N)r   r   r   r   r!   r)   r&   r*   r+   r,   r    r   r   r   r   r1   ä   s   
r1   c                   @  s,   e Zd ZU ejZdZded< ej	ddZ
dS )Ú
UInt8DtypeZUInt8r%   r&   Úuint8r(   N)r   r   r   r   r3   r)   r&   r*   r+   r,   r    r   r   r   r   r2   ë   s   
r2   c                   @  s,   e Zd ZU ejZdZded< ej	ddZ
dS )ÚUInt16DtypeZUInt16r%   r&   Úuint16r(   N)r   r   r   r   r5   r)   r&   r*   r+   r,   r    r   r   r   r   r4   ò   s   
r4   c                   @  s,   e Zd ZU ejZdZded< ej	ddZ
dS )ÚUInt32DtypeZUInt32r%   r&   Úuint32r(   N)r   r   r   r   r7   r)   r&   r*   r+   r,   r    r   r   r   r   r6   ù   s   
r6   c                   @  s,   e Zd ZU ejZdZded< ej	ddZ
dS )ÚUInt64DtypeZUInt64r%   r&   Úuint64r(   N)r   r   r   r   r9   r)   r&   r*   r+   r,   r    r   r   r   r   r8      s   
r8   r   r   )#Ú
__future__r   Útypingr   Únumpyr   Zpandas.core.dtypes.baser   Zpandas.core.dtypes.commonr   Zpandas.core.arrays.numericr   r   r   r
   r+   r$   r-   r/   r1   r2   r4   r6   r8   r   r'   r.   r0   r!   r3   r5   r7   r9   r   r*   r   r   r   r   Ú<module>   sB   0LCø