U
    c                     @  s   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 e dZdS )    )annotationsN)is_float_dtype)register_extension_dtype)NumericArrayNumericDtypec                   @  sV   e Zd ZdZeejZeZ	e
ddddZe
dd Ze
dd	d
ddddZdS )FloatingDtypea  
    An ExtensionDtype to hold a single size of floating dtype.

    These specific implementations are subclasses of the non-public
    FloatingDtype. For example we have Float32Dtype to represent float32.

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

        Returns
        -------
        type
        )FloatingArraycls r   ?/tmp/pip-unpacked-wheel-g7fro6k3/pandas/core/arrays/floating.pyconstruct_array_type   s    	z"FloatingDtype.construct_array_typec                 C  s   t S )N)FLOAT_STR_TO_DTYPEr
   r   r   r   _str_to_dtype_mapping&   s    z#FloatingDtype._str_to_dtype_mappingz
np.ndarrayznp.dtypebool)valuesdtypecopyr   c                 C  s   |j ||dS )z{
        Safely cast the values to the given dtype.

        "safe" in this context means the casting is lossless.
        )r   )Zastype)r   r   r   r   r   r   r   
_safe_cast*   s    	zFloatingDtype._safe_castN)__name__
__module____qualname____doc__npr   float64Z_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ejZdZ	dZ
dS )r	   a  
    Array of floating (optional missing) values.

    .. versionadded:: 1.2.0

    .. warning::

       FloatingArray is currently experimental, and its API or internal
       implementation may change without warning. Especially the behaviour
       regarding NaN (distinct from NA missing values) is subject to change.

    We represent a FloatingArray with 2 numpy arrays:

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

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

    See :ref:`integer_na` for more.

    Parameters
    ----------
    values : numpy.ndarray
        A 1-d float-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
    -------
    FloatingArray

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

    >>> pd.array([0.1, None, 0.3], dtype=pd.Float32Dtype())
    <FloatingArray>
    [0.1, <NA>, 0.3]
    Length: 3, dtype: Float32

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

    >>> pd.array([0.1, None, 0.3], dtype="Float32")
    <FloatingArray>
    [0.1, <NA>, 0.3]
    Length: 3, dtype: Float32
    g      ?g        N)r   r   r   r   r   Z
_dtype_clsr   nanZ_internal_fill_valueZ_truthy_valueZ_falsey_valuer   r   r   r   r	   6   s
   ;r	   z
An ExtensionDtype for {dtype} data.

This dtype uses ``pd.NA`` as missing value indicator.

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

Methods
-------
None
c                   @  s"   e Zd ZejZdZejddZ	dS )Float32DtypeZFloat32float32r   N)
r   r   r   r   r   typename_dtype_docstringformatr   r   r   r   r   r      s   r   c                   @  s"   e Zd ZejZdZejddZ	dS )Float64DtypeZFloat64r   r    N)
r   r   r   r   r   r!   r"   r#   r$   r   r   r   r   r   r%      s   r%   )r   r   )
__future__r   Znumpyr   Zpandas.core.dtypes.commonr   Zpandas.core.dtypes.dtypesr   Zpandas.core.arrays.numericr   r   r   r	   r#   r   r%   r   r   r   r   r   <module>   s   (E