o
    $ÎjF  ã                   @  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                   @  sJ   e Zd ZdZe ej¡ZeZ	e
ddd„ƒZe
ddd„ƒZe
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.
    Úreturnútype[IntegerArray]c                 C  ó   t S )zq
        Return the array type associated with this dtype.

        Returns
        -------
        type
        )ÚIntegerArray©Úcls© r   ú[/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/pandas/core/arrays/integer.pyÚconstruct_array_type   s   	z!IntegerDtype.construct_array_typeúdict[np.dtype, IntegerDtype]c                 C  r   )N)ÚNUMPY_INT_TO_DTYPEr   r   r   r   Ú_get_dtype_mapping(   s   zIntegerDtype._get_dtype_mappingÚvaluesú
np.ndarrayÚdtypeúnp.dtypeÚcopyÚboolc              
   C  st   z	|j |d|dW S  ty9 } z$|j ||d}||k ¡ r&|W  Y d}~S td|j› dt |¡› ƒ|‚d}~ww )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)r	   r
   )r	   r   )r   r   r   r   r   r   r	   r   )Ú__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                   @  ó,   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)   Ï   ó   
 r)   c                   @  r(   )Ú
Int16DtypeZInt16r*   r+   Úint16r-   N)r!   r"   r#   r   r4   r.   r+   r/   r0   r1   r$   r   r   r   r   r3   Ö   r2   r3   c                   @  r(   )Ú
Int32DtypeZInt32r*   r+   Úint32r-   N)r!   r"   r#   r   r6   r.   r+   r/   r0   r1   r$   r   r   r   r   r5   Ý   r2   r5   c                   @  r(   )Ú
Int64DtypeZInt64r*   r+   r%   r-   N)r!   r"   r#   r   r%   r.   r+   r/   r0   r1   r$   r   r   r   r   r7   ä   r2   r7   c                   @  r(   )Ú
UInt8DtypeZUInt8r*   r+   Úuint8r-   N)r!   r"   r#   r   r9   r.   r+   r/   r0   r1   r$   r   r   r   r   r8   ë   r2   r8   c                   @  r(   )ÚUInt16DtypeZUInt16r*   r+   Úuint16r-   N)r!   r"   r#   r   r;   r.   r+   r/   r0   r1   r$   r   r   r   r   r:   ò   r2   r:   c                   @  r(   )ÚUInt32DtypeZUInt32r*   r+   Úuint32r-   N)r!   r"   r#   r   r=   r.   r+   r/   r0   r1   r$   r   r   r   r   r<   ù   r2   r<   c                   @  r(   )ÚUInt64DtypeZUInt64r*   r+   Úuint64r-   N)r!   r"   r#   r   r?   r.   r+   r/   r0   r1   r$   r   r   r   r   r>      r2   r>   r   r   )#Ú
__future__r   Útypingr   Únumpyr   Zpandas.core.dtypes.baser   Zpandas.core.dtypes.commonr   Zpandas.core.arrays.numericr   r   r   r   r0   r)   r3   r5   r7   r8   r:   r<   r>   r   r,   r4   r6   r%   r9   r;   r=   r?   r   r/   r   r   r   r   Ú<module>   sD    0LCø