zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
U
¬ý°d×ã    @s4UddlmZddlZddlmZddlmZddlm    Z    m
Z
Gdd„de
ƒZ Gdd    „d    e    ƒZ d
Z eGd d „d e ƒƒZeGd d„de ƒƒZeGdd„de ƒƒZeGdd„de ƒƒZeGdd„de ƒƒZeGdd„de ƒƒZeGdd„de ƒƒZeGdd„de ƒƒZeƒeƒeƒeƒeƒeƒeƒeƒdœZded<dS)é)Ú annotationsN)Úregister_extension_dtype)Úis_integer_dtype)Ú NumericArrayÚ NumericDtypec@sVeZdZdZe ej¡ZeZ    e
ddœdd„ƒZ e
dd„ƒZ e
dd    d
dd œd d „ƒZ dS)Ú 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.
    ztype[IntegerArray])ÚreturncCstS)zq
        Return the array type associated with this dtype.
 
        Returns
        -------
        type
        )Ú IntegerArray©Úcls©r úQd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/core/arrays/integer.pyÚconstruct_array_types    z!IntegerDtype.construct_array_typecCstS)N)ÚINT_STR_TO_DTYPEr
r r r Ú_str_to_dtype_mapping&sz"IntegerDtype._str_to_dtype_mappingz
np.ndarrayznp.dtypeÚbool)ÚvaluesÚdtypeÚcopyrc
Cs~z|j|d|dWStk
rx}zH|j||d}||k ¡rJ|WY¢$Std|j›dt |¡›ƒ|‚W5d}~XYnXdS)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)Zcastingr)rz"cannot safely cast non-equivalent z to N)ZastypeÚ    TypeErrorÚallrÚnp)r rrrÚerrZcastedr r r Ú
_safe_cast*s  ÿþzIntegerDtype._safe_castN)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrÚint64Z_default_np_dtyperZ_checkerÚ classmethodrrrr r r r rs     
 
rc@s eZdZdZeZdZdZdZdS)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
    érN)    rrrrrZ
_dtype_clsZ_internal_fill_valueZ _truthy_valueZ _falsey_valuer r r r r    >s
@r    z¬
An ExtensionDtype for {dtype} integer data.
 
Uses :attr:`pandas.NA` as its missing value, rather than :attr:`numpy.nan`.
 
Attributes
----------
None
 
Methods
-------
None
c@s"eZdZejZdZejddZ    dS)Ú    Int8DtypeZInt8Úint8©rN)
rrrrr#ÚtypeÚnameÚ_dtype_docstringÚformatrr r r r r"›sr"c@s"eZdZejZdZejddZ    dS)Ú
Int16DtypeZInt16Úint16r$N)
rrrrr*r%r&r'r(rr r r r r)¢sr)c@s"eZdZejZdZejddZ    dS)Ú
Int32DtypeZInt32Úint32r$N)
rrrrr,r%r&r'r(rr r r r r+©sr+c@s"eZdZejZdZejddZ    dS)Ú
Int64DtypeZInt64rr$N)
rrrrrr%r&r'r(rr r r r r-°sr-c@s"eZdZejZdZejddZ    dS)Ú
UInt8DtypeZUInt8Úuint8r$N)
rrrrr/r%r&r'r(rr r r r r.·sr.c@s"eZdZejZdZejddZ    dS)Ú UInt16DtypeZUInt16Úuint16r$N)
rrrrr1r%r&r'r(rr r r r r0¾sr0c@s"eZdZejZdZejddZ    dS)Ú UInt32DtypeZUInt32Úuint32r$N)
rrrrr3r%r&r'r(rr r r r r2Åsr2c@s"eZdZejZdZejddZ    dS)Ú UInt64DtypeZUInt64Úuint64r$N)
rrrrr5r%r&r'r(rr r r r r4Ìsr4)r#r*r,rr/r1r3r5zdict[str, IntegerDtype]r)Ú
__future__rÚnumpyrZpandas.core.dtypes.baserZpandas.core.dtypes.commonrZpandas.core.arrays.numericrrrr    r'r"r)r+r-r.r0r2r4rÚ__annotations__r r r r Ú<module>sB   0Lø