
    Mh+                       S SK Jr  S SK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  S SKJrJrJrJrJrJrJrJrJr  S S	KJr  S S
KJrJr  S SKJ r   S SK!J"r"  \(       a
  S SK#J$r$J%r%J&r&  SS\	RN                  4     SS jjr(g)    )annotations)TYPE_CHECKINGLiteralN)lib)find_stack_level)check_dtype_backend)maybe_downcast_numeric)	ensure_objectis_bool_dtype
is_decimalis_integer_dtype	is_numberis_numeric_dtype	is_scalaris_string_dtypeneeds_i8_conversion)
ArrowDtype)ABCIndex	ABCSeries)BaseMaskedArray)StringDtype)DateTimeErrorChoicesDtypeBackendnptraisec           	        US;  a  [        S5      eUS;  a  [        S5      eUS:X  a"  [        R                  " S[        [	        5       S9  [        U5        SnSnSn[        U [        5      (       a  S	nU R                  nO[        U [        5      (       a;  S	n[        U R                  5      (       a  U R                  S
5      nOU R                  nO[        U [        [        45      (       a  [        R                   " U SS9nOt[#        U 5      (       aF  [%        U 5      (       a  ['        U 5      $ [)        U 5      (       a  U $ S	n[        R                   " U /SS9nO[+        U SS5      S:  a  [-        S5      eU nUnSn	[        U[.        5      (       a  UR0                  n	UR2                  U	)    n[+        USS5      n
[        U
[4        5      (       a.  UR7                  5       n	UR9                  5       R;                  5       nSn[=        U
5      (       a  O[>        R@                  " U
S5      (       a   UR                  [        RB                  5      nOp[E        U5      nUS;  n [>        RF                  " U[I        5       UU[>        RJ                  L=(       d'    [        U
[L        5      =(       a    U
RN                  S:X  + S9u  p{Ub  X{)    nOhU[>        RJ                  La  Ub%  [        U
[L        5      (       a=  U
RN                  S:X  d-  [        RP                  " URR                  [        RT                  S9nUGb=  [=        UR                  5      (       Ga"  SnUS;   a  [        RV                  S   nOUS:X  a>  [Y        U5      (       a  [        RZ                  " U5      S:  a  [        RV                  S   nO\US:X  aV  [        RV                  S   n[        R                  " [        R\                  5      R^                  nURa                  U5      nXS nUbc  U H]  n[        R                  " U5      nURb                  UR                  Rb                  ::  d  M?  [e        UU5      nUR                  U:X  d  M]    O   U	c  UGb   [g        UR                  5      (       Gd  U	b  Ub  URR                  U	RR                  :X  a  Un	OU	Ri                  5       n	[        U	[        Rj                  5      (       d   e[        RP                  " U	RR                  UR                  S9nUUU	) '   SSK6J7nJ8nJ9nJ:n  [w        UR                  5      (       a  UnO[y        UR                  5      (       a  UnOUnU" UU	5      nUS:X  d  [        U
[4        5      (       a  U" UR{                  5       5      nU(       a$  U R}                  XpR`                  U R~                  S 9$ U(       a  SS!K@JAn  U" XpR~                  S"9$ U(       a  US   $ U$ ! [         [,        4 a    US:X  a  e Un GNKf = f)#a3  
Convert argument to a numeric type.

The default return dtype is `float64` or `int64`
depending on the data supplied. Use the `downcast` parameter
to obtain other dtypes.

Please note that precision loss may occur if really large numbers
are passed in. Due to the internal limitations of `ndarray`, if
numbers smaller than `-9223372036854775808` (np.iinfo(np.int64).min)
or larger than `18446744073709551615` (np.iinfo(np.uint64).max) are
passed in, it is very likely they will be converted to float so that
they can be stored in an `ndarray`. These warnings apply similarly to
`Series` since it internally leverages `ndarray`.

Parameters
----------
arg : scalar, list, tuple, 1-d array, or Series
    Argument to be converted.
errors : {'ignore', 'raise', 'coerce'}, default 'raise'
    - If 'raise', then invalid parsing will raise an exception.
    - If 'coerce', then invalid parsing will be set as NaN.
    - If 'ignore', then invalid parsing will return the input.

    .. versionchanged:: 2.2

    "ignore" is deprecated. Catch exceptions explicitly instead.

downcast : str, default None
    Can be 'integer', 'signed', 'unsigned', or 'float'.
    If not None, and if the data has been successfully cast to a
    numerical dtype (or if the data was numeric to begin with),
    downcast that resulting data to the smallest numerical dtype
    possible according to the following rules:

    - 'integer' or 'signed': smallest signed int dtype (min.: np.int8)
    - 'unsigned': smallest unsigned int dtype (min.: np.uint8)
    - 'float': smallest float dtype (min.: np.float32)

    As this behaviour is separate from the core conversion to
    numeric values, any errors raised during the downcasting
    will be surfaced regardless of the value of the 'errors' input.

    In addition, downcasting will only occur if the size
    of the resulting data's dtype is strictly larger than
    the dtype it is to be cast to, so if none of the dtypes
    checked satisfy that specification, no downcasting will be
    performed on the data.
dtype_backend : {'numpy_nullable', 'pyarrow'}, default 'numpy_nullable'
    Back-end data type applied to the resultant :class:`DataFrame`
    (still experimental). Behaviour is as follows:

    * ``"numpy_nullable"``: returns nullable-dtype-backed :class:`DataFrame`
      (default).
    * ``"pyarrow"``: returns pyarrow-backed nullable :class:`ArrowDtype`
      DataFrame.

    .. versionadded:: 2.0

Returns
-------
ret
    Numeric if parsing succeeded.
    Return type depends on input.  Series if Series, otherwise ndarray.

See Also
--------
DataFrame.astype : Cast argument to a specified dtype.
to_datetime : Convert argument to datetime.
to_timedelta : Convert argument to timedelta.
numpy.ndarray.astype : Cast a numpy array to a specified type.
DataFrame.convert_dtypes : Convert dtypes.

Examples
--------
Take separate series and convert to numeric, coercing when told to

>>> s = pd.Series(['1.0', '2', -3])
>>> pd.to_numeric(s)
0    1.0
1    2.0
2   -3.0
dtype: float64
>>> pd.to_numeric(s, downcast='float')
0    1.0
1    2.0
2   -3.0
dtype: float32
>>> pd.to_numeric(s, downcast='signed')
0    1
1    2
2   -3
dtype: int8
>>> s = pd.Series(['apple', '1.0', '2', -3])
>>> pd.to_numeric(s, errors='coerce')
0    NaN
1    1.0
2    2.0
3   -3.0
dtype: float64

Downcasting of nullable integer and floating dtypes is supported:

>>> s = pd.Series([1, 2, 3], dtype="Int64")
>>> pd.to_numeric(s, downcast="integer")
0    1
1    2
2    3
dtype: Int8
>>> s = pd.Series([1.0, 2.1, 3.0], dtype="Float64")
>>> pd.to_numeric(s, downcast="float")
0    1.0
1    2.1
2    3.0
dtype: Float32
)Nintegersignedunsignedfloatz#invalid downcasting method provided)ignorer   coercezinvalid error value specifiedr!   zerrors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead)
stacklevelFTi8O)dtypendim   z/arg must be a list, tuple, 1-d array, or SeriesNr&   mM)r!   r   pyarrow_numpy)coerce_numericconvert_to_masked_nullabler   )r   r   Integerr   r   UnsignedIntegerr    Float)ArrowExtensionArrayBooleanArrayFloatingArrayIntegerArraypyarrow)indexname)Index)r6   )B
ValueErrorwarningswarnFutureWarningr   r   
isinstancer   valuesr   r   r&   viewlisttuplenparrayr   r   r    r   getattr	TypeErrorr   _mask_datar   isnadropnato_numpyr   r   is_np_dtypeint64r
   maybe_convert_numericset
no_defaultr   storagezerosshapebool_	typecodeslenminfloat32charr5   itemsizer	   r   copyndarraypandas.core.arraysr0   r1   r2   r3   r   r   __arrow_array___constructorr6   pandasr7   )argerrorsdowncastdtype_backend	is_seriesis_index
is_scalarsr=   orig_valuesmaskvalues_dtypenew_maskr+   rS   float_32_charfloat_32_indtypecoder&   datar0   r1   r2   r3   klassr7   s                            K/var/www/html/env/lib/python3.13/site-packages/pandas/core/tools/numeric.py
to_numericrp   ,   s   t GG>??22899! ')	
 &IHJ#y!!		C	"	"syy))XXd^FZZF	C$	'	'#S)	3c??:S>>J
3%s+	fa	 1	$IJJK *.D&/**||te$67D1L,
++{{}))+"&H%%	t	,	,RXX&v&'::	!"88-+8+N ,@lK8 @$,,? F  	"S^^+lK00$$788FLL9  0 > > $	,,Y/I#S[[BFF6Na<O%67I W-I
 HHRZZ055M$??=9L!-0I %*>>V\\%:%::3FEBF ||u, & 	H0/&,,:W:W<H0X^^tzz5QD99;D$

++++xx

&,,7dU	
 	
 DJJ'' E4::&& E!EtT"I%L*)M)M()?)?)ABFiichhGG	 	!V((++	ays I& 	!  F	!s   AW( (XX)r`   r   ra   z8Literal['integer', 'signed', 'unsigned', 'float'] | Nonerb   zDtypeBackend | lib.NoDefault))
__future__r   typingr   r   r9   numpyrA   pandas._libsr   pandas.util._exceptionsr   pandas.util._validatorsr   pandas.core.dtypes.castr	   pandas.core.dtypes.commonr
   r   r   r   r   r   r   r   r   pandas.core.dtypes.dtypesr   pandas.core.dtypes.genericr   r   r[   r   pandas.core.arrays.string_r   pandas._typingr   r   r   rN   rp        ro   <module>r      s    "    4 7 :
 
 
 1
 / 2  $+IM25..	] ] G] 0	]r~   