
    Mhf                       S r SSKJr  SSKJr  SSKJrJrJrJ	r	J
r
  SSKrSSKrSSKJr  SSKJr  SSKJr  SS	KJrJrJr  SS
KJrJrJrJrJr  SSKJr  SSKJ r   SSK!J"r"J#r#J$r$J%r%J&r&J'r'J(r(  SSK)J*r*J+r+J,r,J-r-  SSK.J/r/  SSK0J1r1J2r2J3r3J4r4  SSK5J6r6  SSK7J8s  J9r:  \(       a  SSK;J<r<J=r=  SSK>J?r?    S$       S%S jjr@\A" 1 Sk5      rB\
 S&       S'S jj5       rC\
 S&       S(S jj5       rC S)       S(S jjrCS rDS*S jrE  S+SS.         S,S jjjrFS-S jrGS.S jrHSS.         S/S  jjrI        S0S! jrJS1S" jrK        S2S# jrLg)3z
Constructor functions intended to be shared by pd.array, Series.__init__,
and Index.__new__.

These should not depend on core.internals.
    )annotations)Sequence)TYPE_CHECKINGOptionalUnioncastoverloadN)ma)using_pyarrow_string_dtype)lib)Periodget_supported_dtypeis_supported_dtype)AnyArrayLike	ArrayLikeDtypeDtypeObjT)find_stack_level)ExtensionDtype)"construct_1d_arraylike_from_scalar'construct_1d_object_array_from_listlikemaybe_cast_to_datetimemaybe_cast_to_integer_arraymaybe_convert_platformmaybe_infer_to_datetimelikemaybe_promote)is_list_likeis_object_dtypeis_string_dtypepandas_dtype)NumpyEADtype)ABCDataFrameABCExtensionArrayABCIndex	ABCSeries)isna)IndexSeries)ExtensionArrayc                   SSK JnJnJnJnJnJnJn	Jn
J	n  SSK
Jn  [        R                  " U 5      (       a  SU  S3n[        U5      e[        U [         5      (       a  [#        S5      eUc(  [        U [$        [&        U45      (       a  U R(                  n[+        U SS	9n Ub  [-        U5      n[        X5      (       a,  Ub  U R(                  U:X  a  U(       a  U R/                  5       $ U $ [        U[0        5      (       a   UR3                  5       nUR5                  XUS
9$ UGcp  [        R6                  " U SS9nUS:X  a;  [9        [:        [<        [>        [@              [B        4   U 5      nU
R5                  UUS9$ US:X  a  U" XS9$ URE                  S5      (       a   UR5                  XS9$ URE                  S5      (       a  UR5                  XS9$ US:X  a'  U" 5       nUR3                  5       nUR5                  XUS
9$ US:X  a  UR5                  XS9$ US:X  a0  [G        U S5      (       d  [I        U 5      (       d  UR5                  XS9$ US;   a.  [K        U SS5      [L        RN                  :w  a  UR5                  XS9$ US:X  a  UR5                  U SUS
9$ [        RP                  " US5      (       a   [S        U5      (       a  UR5                  XUS
9$ [        RP                  " US5      (       a   [S        U5      (       a  UR5                  XUS
9$ [        RP                  " US5      (       a"  [T        RV                  " S[X        [[        5       S9  U	R5                  XUS
9$ ! [         a     Nf = f)aB  
Create an array.

Parameters
----------
data : Sequence of objects
    The scalars inside `data` should be instances of the
    scalar type for `dtype`. It's expected that `data`
    represents a 1-dimensional array of data.

    When `data` is an Index or Series, the underlying array
    will be extracted from `data`.

dtype : str, np.dtype, or ExtensionDtype, optional
    The dtype to use for the array. This may be a NumPy
    dtype or an extension type registered with pandas using
    :meth:`pandas.api.extensions.register_extension_dtype`.

    If not specified, there are two possibilities:

    1. When `data` is a :class:`Series`, :class:`Index`, or
       :class:`ExtensionArray`, the `dtype` will be taken
       from the data.
    2. Otherwise, pandas will attempt to infer the `dtype`
       from the data.

    Note that when `data` is a NumPy array, ``data.dtype`` is
    *not* used for inferring the array type. This is because
    NumPy cannot represent all the types of data that can be
    held in extension arrays.

    Currently, pandas will infer an extension dtype for sequences of

    ============================== =======================================
    Scalar Type                    Array Type
    ============================== =======================================
    :class:`pandas.Interval`       :class:`pandas.arrays.IntervalArray`
    :class:`pandas.Period`         :class:`pandas.arrays.PeriodArray`
    :class:`datetime.datetime`     :class:`pandas.arrays.DatetimeArray`
    :class:`datetime.timedelta`    :class:`pandas.arrays.TimedeltaArray`
    :class:`int`                   :class:`pandas.arrays.IntegerArray`
    :class:`float`                 :class:`pandas.arrays.FloatingArray`
    :class:`str`                   :class:`pandas.arrays.StringArray` or
                                   :class:`pandas.arrays.ArrowStringArray`
    :class:`bool`                  :class:`pandas.arrays.BooleanArray`
    ============================== =======================================

    The ExtensionArray created when the scalar type is :class:`str` is determined by
    ``pd.options.mode.string_storage`` if the dtype is not explicitly given.

    For all other cases, NumPy's usual inference rules will be used.
copy : bool, default True
    Whether to copy the data, even if not necessary. Depending
    on the type of `data`, creating the new array may require
    copying data, even if ``copy=False``.

Returns
-------
ExtensionArray
    The newly created array.

Raises
------
ValueError
    When `data` is not 1-dimensional.

See Also
--------
numpy.array : Construct a NumPy array.
Series : Construct a pandas Series.
Index : Construct a pandas Index.
arrays.NumpyExtensionArray : ExtensionArray wrapping a NumPy array.
Series.array : Extract the array stored within a Series.

Notes
-----
Omitting the `dtype` argument means pandas will attempt to infer the
best array type from the values in the data. As new array types are
added by pandas and 3rd party libraries, the "best" array type may
change. We recommend specifying `dtype` to ensure that

1. the correct array type for the data is returned
2. the returned array type doesn't change as new extension types
   are added by pandas and third-party libraries

Additionally, if the underlying memory representation of the returned
array matters, we recommend specifying the `dtype` as a concrete object
rather than a string alias or allowing it to be inferred. For example,
a future version of pandas or a 3rd-party library may include a
dedicated ExtensionArray for string data. In this event, the following
would no longer return a :class:`arrays.NumpyExtensionArray` backed by a
NumPy array.

>>> pd.array(['a', 'b'], dtype=str)
<NumpyExtensionArray>
['a', 'b']
Length: 2, dtype: str32

This would instead return the new ExtensionArray dedicated for string
data. If you really need the new array to be backed by a  NumPy array,
specify that in the dtype.

>>> pd.array(['a', 'b'], dtype=np.dtype("<U1"))
<NumpyExtensionArray>
['a', 'b']
Length: 2, dtype: str32

Finally, Pandas has arrays that mostly overlap with NumPy

  * :class:`arrays.DatetimeArray`
  * :class:`arrays.TimedeltaArray`

When data with a ``datetime64[ns]`` or ``timedelta64[ns]`` dtype is
passed, pandas will always return a ``DatetimeArray`` or ``TimedeltaArray``
rather than a ``NumpyExtensionArray``. This is for symmetry with the case of
timezone-aware data, which NumPy does not natively support.

>>> pd.array(['2015', '2016'], dtype='datetime64[ns]')
<DatetimeArray>
['2015-01-01 00:00:00', '2016-01-01 00:00:00']
Length: 2, dtype: datetime64[ns]

>>> pd.array(["1h", "2h"], dtype='timedelta64[ns]')
<TimedeltaArray>
['0 days 01:00:00', '0 days 02:00:00']
Length: 2, dtype: timedelta64[ns]

Examples
--------
If a dtype is not specified, pandas will infer the best dtype from the values.
See the description of `dtype` for the types pandas infers for.

>>> pd.array([1, 2])
<IntegerArray>
[1, 2]
Length: 2, dtype: Int64

>>> pd.array([1, 2, np.nan])
<IntegerArray>
[1, 2, <NA>]
Length: 3, dtype: Int64

>>> pd.array([1.1, 2.2])
<FloatingArray>
[1.1, 2.2]
Length: 2, dtype: Float64

>>> pd.array(["a", None, "c"])
<StringArray>
['a', <NA>, 'c']
Length: 3, dtype: string

>>> with pd.option_context("string_storage", "pyarrow"):
...     arr = pd.array(["a", None, "c"])
...
>>> arr
<ArrowStringArray>
['a', <NA>, 'c']
Length: 3, dtype: string

>>> pd.array([pd.Period('2000', freq="D"), pd.Period("2000", freq="D")])
<PeriodArray>
['2000-01-01', '2000-01-01']
Length: 2, dtype: period[D]

You can use the string alias for `dtype`

>>> pd.array(['a', 'b', 'a'], dtype='category')
['a', 'b', 'a']
Categories (2, object): ['a', 'b']

Or specify the actual dtype

>>> pd.array(['a', 'b', 'a'],
...          dtype=pd.CategoricalDtype(['a', 'b', 'c'], ordered=True))
['a', 'b', 'a']
Categories (3, object): ['a' < 'b' < 'c']

If pandas does not infer a dedicated extension type a
:class:`arrays.NumpyExtensionArray` is returned.

>>> pd.array([1 + 1j, 3 + 2j])
<NumpyExtensionArray>
[(1+1j), (3+2j)]
Length: 2, dtype: complex128

As mentioned in the "Notes" section, new extension types may be added
in the future (by pandas or 3rd party libraries), causing the return
value to no longer be a :class:`arrays.NumpyExtensionArray`. Specify the
`dtype` as a NumPy dtype if you need to ensure there's no future change in
behavior.

>>> pd.array([1, 2], dtype=np.dtype("int32"))
<NumpyExtensionArray>
[1, 2]
Length: 2, dtype: int32

`data` must be 1-dimensional. A ValueError is raised when the input
has the wrong dimensionality.

>>> pd.array(1)
Traceback (most recent call last):
  ...
ValueError: Cannot pass scalar '1' to 'pandas.array'.
r   )	BooleanArrayDatetimeArrayr*   FloatingArrayIntegerArrayIntervalArrayNumpyExtensionArrayPeriodArrayTimedeltaArrayStringDtypezCannot pass scalar 'z' to 'pandas.array'.z'Cannot pass DataFrame to 'pandas.array'NT)extract_numpydtypecopy)skipnaperiodr9   intervaldatetime	timedeltastringintegeremptyr8   )floatingzmixed-integer-floatbooleanMmmMzdatetime64 and timedelta64 dtype resolutions other than 's', 'ms', 'us', and 'ns' are deprecated. In future releases passing unsupported resolutions will raise an exception.)
stacklevel).pandas.core.arraysr,   r-   r*   r.   r/   r0   r1   r2   r3   pandas.core.arrays.string_r5   r   	is_scalar
ValueError
isinstancer#   	TypeErrorr&   r%   r8   extract_arrayr!   r9   r   construct_array_type_from_sequenceinfer_dtyper   r   r   r   r   r   
startswithhasattrlengetattrnpfloat16is_np_dtyper   warningswarnFutureWarningr   )datar8   r9   r,   r-   r*   r.   r/   r0   r1   r2   r3   r5   msgclsinferred_dtypeperiod_datas                    J/var/www/html/env/lib/python3.13/site-packages/pandas/core/construction.pyarrayrc   J   sB   d
 
 
 7
}}T$TF*>?o	D,	'	'ABB}D9h*OPP

T2D U#$''U]djjE>Q99;%((((*!!$$!??}d;X%uXhv.>%?%MNPTUK--k-EEz) 11&&z22$33D3DD
 &&{33!000AAx'ME,,.C%%dd%CCy(..t.??w&wtW/E/EcRVii ///@@AAgt,

: !///@@y(..t94.PP uc""'9%'@'@++DD+II
uc""'9%'@'@,,TT,JJ		%	%# ')	
 --dd-KKa  s   M 
M$#M$>	   indexseries
multiindex
rangeindexperiodindexdatetimeindexintervalindextimedeltaindexcategoricalindexc                    g N objr6   extract_ranges      rb   rO   rO              c                    g rn   ro   rp   s      rb   rO   rO     rs   rt   Fc                    [        U SS5      nU[        ;   a'  US:X  a  U(       a  U R                  $ U $ U R                  $ U(       a  US:X  a  U R                  5       $ U $ )a  
Extract the ndarray or ExtensionArray from a Series or Index.

For all other types, `obj` is just returned as is.

Parameters
----------
obj : object
    For Series / Index, the underlying ExtensionArray is unboxed.

extract_numpy : bool, default False
    Whether to extract the ndarray from a NumpyExtensionArray.

extract_range : bool, default False
    If we have a RangeIndex, return range._values if True
    (which is a materialized integer ndarray), otherwise return unchanged.

Returns
-------
arr : object

Examples
--------
>>> extract_array(pd.Series(['a', 'b', 'c'], dtype='category'))
['a', 'b', 'c']
Categories (3, object): ['a', 'b', 'c']

Other objects like lists, arrays, and DataFrames are just passed through.

>>> extract_array([1, 2, 3])
[1, 2, 3]

For an ndarray-backed Series / Index the ndarray is returned.

>>> extract_array(pd.Series([1, 2, 3]))
array([1, 2, 3])

To extract all the way down to the ndarray, pass ``extract_numpy=True``.

>>> extract_array(pd.Series([1, 2, 3]), extract_numpy=True)
array([1, 2, 3])
_typNrg   npy_extension)rV   _typs_valuesto_numpy)rq   r6   rr   typs       rb   rO   rO     s]    Z #vt
$C
e|,{{"J {{	3/1 ||~Jrt   c                T   [        U [        R                  5      (       a  U R                  R                  S:X  a*  SSKJn  [        U R                  5      nUR                  XS9$ U R                  R                  S:X  a*  SSKJ	n  [        U R                  5      nUR                  XS9$ U $ )zK
Wrap datetime64 and timedelta64 ndarrays in DatetimeArray/TimedeltaArray.
rE   r   )r-   r8   rF   )r3   )
rM   rW   ndarrayr8   kindrI   r-   r   rQ   r3   )arrr-   r8   r3   s       rb   ensure_wrapped_if_datetimeliker     s     #rzz""99>>S 8'		2E ///AAYY^^s"9'		2E!000BBJrt   c                p   [         R                  " U 5      nUR                  5       (       az  [        U R                  [
        R                  5      u  p#[        [
        R                  U5      n[         R                  " U R                  USS95      n U R                  5         X0U'   U $ U R                  5       n U $ )z7
Convert numpy MaskedArray to ensure mask is softened.
Tr<   )r
   getmaskarrayanyr   r8   rW   nanr   asarrayastypesoften_maskr9   )r]   maskr8   
fill_values       rb   sanitize_masked_arrayr     s     ??4 Dxxzz)$**bff=RXXu%zz$++e$+78T
 K yy{Krt   allow_2dc                  Un[        U [        R                  5      (       a  [        U 5      n [        U[        5      (       a  UR
                  nSn[        U [        5      (       a  U R                  [        :X  a  Uc  Sn[        U SSS9n [        U [        R                  5      (       a6  U R                  S:X  a&  Uc  U R                  n[        R                  " U 5      n O"[        U [        5      (       a  [!        U 5      n Sn[#        U 5      (       d[  Uc  [%        S5      e[        U [&        5      (       a   [)        5       (       a  Uc  SSKJn  U" S5      n[/        U [1        U5      U5      n U $ [        U [2        5      (       a1  Ub  U R5                  X#S9nGOaU(       a  U R7                  5       nGOHU nGOD[        U[8        5      (       a-  [;        U 5        UR=                  5       n	U	R?                  XUS	9nGO[        U [        R                  5      (       a  [        U [        R@                  5      (       a  U RB                  n Uc  U nU R                  [        :X  a4  [E        U 5      nU(       a!  [)        5       (       a  [G        U5      (       a  U nORU R                  RH                  S
:X  a8  [)        5       (       a)  SSKJn  U" SS9nUR=                  5       R?                  XS9nXL a  U(       a  UR7                  5       nO[K        XU5      nO[M        U S5      (       a?  U(       d  [        RN                  " U 5      n O[        RP                  " XS9n [S        U UUSUS9$ [;        U 5        [U        U 5      n [1        U 5      S:X  a'  Uc$  [        RP                  " / [        RV                  S9nOTUb  [K        XU5      nOD[Y        U 5      nUR                  [        :X  a%  [[        [        R                  U5      n[E        U5      n[]        XX!US9n[        U[        R                  5      (       a&  [[        [        R                  U5      n[_        XX#5      nU$ )a  
Sanitize input data to an ndarray or ExtensionArray, copy if specified,
coerce to the dtype if specified.

Parameters
----------
data : Any
index : Index or None, default None
dtype : np.dtype, ExtensionDtype, or None, default None
copy : bool, default False
allow_2d : bool, default False
    If False, raise if we have a 2D Arraylike.

Returns
-------
np.ndarray or ExtensionArray
FT)r6   rr   r   z2index must be specified when data is not list-liker4   pyarrow_numpyr<   r7   U)storager~   	__array__)rd   r8   r9   r   r   )0rM   r
   MaskedArrayr   r"   numpy_dtyper%   r8   objectrO   rW   r   ndimr   item_from_zerodimrangerange_to_ndarrayr   rL   strr   rJ   r5   r   rU   r$   r   r9   r   _sanitize_non_orderedrP   rQ   matrixAr   r    r   	_try_castrT   r   rc   sanitize_arraylistfloat64r   r   _sanitize_ndim_sanitize_str_dtypes)
r]   rd   r8   r9   r   original_dtypeobject_indexr5   subarrr_   s
             rb   r   r     se   2 N$''$T*%&&!!L$!!djjF&:u} TFD$

##		Q=JJE$$T*	D%	 	 %=QRRtS!!*,,&>0E1$E
EJ	D+	,	, [[[2FYY[FF	E>	*	*d#((*##DD#A 
D"**	%	%dBII&&66D=FzzV#4T: 244'// "FC',F,H,HB#O<335DDTDW~$ tD1F	{	#	#::d#D88D,D
 	
 	d#Dzt9>emXXb

3FtD1F ,D1F||v%bjj&14V<F%JF&"**%%RXXu%%fE@Mrt   c                    [         R                  " U R                  U R                  U R                  SS9nU$ ! [
         a    U R                  S:  a  U R                  S:  d$  U R                  Ss=:  a  U R                  ::  a^  O  O[ [         R                  " U R                  U R                  U R                  SS9nO8! [
         a    [        [        U 5      5      n Of = f[        [        U 5      5      n U$ f = f)z!
Cast a range object to ndarray.
int64r~   r   uint64)rW   arangestartstopstepOverflowErrorr   r   )rngr   s     rb   r   r     s    

Eii		388SXXWE J  EIINsxx!|A1I1IIii		388SXXXN  I=d3iHI :$s)DCJEs4   59 AC:5B>=C:>CC:CC:9C:c                ~    [        U [        [        45      (       a"  [        S[	        U 5      R
                   S35      eg)z8
Raise only for unordered sets, e.g., not for dict_keys
'z' type is unorderedN)rM   set	frozensetrN   type__name__)r]   s    rb   r   r     s;     $i())!DJ//00CDEE *rt   c                   [        U SS5      S:X  a  [        S5      eU R                  S:X  a  [        X5      n U $ U R                  S:  a  [	        U[
        R                  5      (       a"  U(       a  U $ [        SUR                   S35      e[        U5      (       a_  [	        U[        5      (       aJ  [        R                  " U[
        R                  " S5      S9n UR                  5       nUR                  XS9n U $ [        R                  " XS9n U $ )	z.
Ensure we have a 1-dimensional result array.
r   r   z(result should be arraylike with ndim > 0   z1Data must be 1-dimensional, got ndarray of shape z insteadr   r~   )rV   rL   r   _maybe_repeatrM   rW   r   shaper   r   comasarray_tuplesafer8   rP   rQ   )resultr]   r8   rd   r   r_   s         rb   r   r     s     vvq!Q&CDD{{av-( M% 
qdBJJ''CDJJ<xX  5!!j&G&G **4rxx7IJF,,.C'''<F M **4=FMrt   c                v   [        U R                  R                  [        5      (       a  [        R
                  " U5      (       dt  [        R                  " [        U5      5      (       d  [        R                  " XS9nU(       d  [        R                  " U[        S9n U $ [        R                  " U[        US9n U $ )z5
Ensure we have a dtype that is supported by pandas.
r~   r7   )
issubclassr8   r   r   r   rK   rW   allr'   r   r   rc   )r   r]   r8   r9   s       rb   r   r     s     &,,##S)) }}T""66$t*%%zz$4D7 M $f4@Mrt   c                    Ub=  S[        U 5      s=:X  a  [        U5      :w  a  O  U $ U R                  [        U5      5      n U $ )zl
If we have a length-1 array and an index describing how long we expect
the result to be, repeat the array.
r   )rU   repeat)r   rd   s     rb   r   r     s=    
 C&CJ&J **SZ(CJrt   c                   [        U [        R                  5      nU[        :X  a,  U(       d  [	        U 5      nU$ [        U 5      R                  XS9$ UR                  S:X  a  U(       aG  [        [        R                  U 5      n U R                  nU R                  S:  a  U R                  5       n O[        U 5      4n[        R                  " U SUS9R                  U5      $ UR                  S;   a  [!        X5      $ UR                  S;   a  [#        X5      nU$ U(       d  [        R$                  " XS9nU$ [        R&                  " XUS	9nU$ )
a  
Convert input to numpy ndarray and optionally cast to a given dtype.

Parameters
----------
arr : ndarray or list
    Excludes: ExtensionArray, Series, Index.
dtype : np.dtype
copy : bool
    If False, don't copy the data if not needed.

Returns
-------
np.ndarray or ExtensionArray
r<   r   r   F)convert_na_valuer9   rG   iur~   r7   )rM   rW   r   r   r   r   r   r   r   r   r   ravelrU   r   ensure_string_arrayreshaper   r   r   rc   )r   r8   r9   
is_ndarrayr   r   s         rb   r   r     s    ( C,J<SAFM-c299%9KK	s	rzz3'CIIExx!|iikXKE&&sUNVV
 	
 
t	%c11 
t	 -S8 M C- M #6Mrt   )NT)r]   zSequence[object] | AnyArrayLiker8   zDtype | Noner9   boolreturnr*   )..)rq   zSeries | Indexr6   r   rr   r   r   r   )rq   r   r6   r   rr   r   r   zT | ArrayLike)FF)r]   zma.MaskedArrayr   
np.ndarray)NF)
rd   Index | Noner8   DtypeObj | Noner9   r   r   r   r   r   )r   r   r   r   )r   None)
r   r   r8   r   rd   r   r   r   r   r   )r   r   r8   znp.dtype | Noner9   r   r   r   )r   r   rd   r   r   r   )r   zlist | np.ndarrayr8   znp.dtyper9   r   r   r   )M__doc__
__future__r   collections.abcr   typingr   r   r   r   r	   rZ   numpyrW   r
   pandas._configr   pandas._libsr   pandas._libs.tslibsr   r   r   pandas._typingr   r   r   r   r   pandas.util._exceptionsr   pandas.core.dtypes.baser   pandas.core.dtypes.castr   r   r   r   r   r   r   pandas.core.dtypes.commonr   r   r    r!   pandas.core.dtypes.dtypesr"   pandas.core.dtypes.genericr#   r$   r%   r&   pandas.core.dtypes.missingr'   pandas.core.commoncorecommonr   pandasr(   r)   pandas.core.arrays.baser*   rc   r   ry   rO   r   r   r   r   r   r   r   r   r   ro   rt   rb   <module>r      sc   # $     5  
  5 2    3  ,     7
 vL
)vLvL vL 	vLr	 	
	 
JM	(,CG 
 
=@	
6: 
 @E>	
>>8<>>B(& "	U UU U 	U U Up&F $$ $ 	$ $ $N%4<@.7	77 7 	7rt   