Ë
    ª2Úi°„  ã                  ó*  — U d Z ddlmZ ddlmZ ddlmZmZmZm	Z	m
Z
 ddlZddlmZ ddlmZmZmZ ddlmZmZmZmZmZ dd	lmZ dd
lmZ ddlmZmZm Z m!Z!m"Z" ddl#m$Z$m%Z%m&Z& ddl'm(Z(m)Z)m*Z* erddl+m,Z, ddlm-Z- ddl.m/Z/ ed   Z0de1d<   d8d„Z2d9d„Z3e
ddœ	 	 	 	 	 d:d„«       Z4e
	 	 	 	 	 	 d;d„«       Z4ddœ	 	 	 	 	 d<d„Z4g d¢Z5g d¢Z6d=d„Z7d>d„Z8	 	 	 	 d?d „Z9d@d!„Z:	 	 	 	 	 	 dAd"„Z;dBd#„Z<	 	 	 	 	 	 dC	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dDd$„Z=dEd%„Z>	 	 	 	 	 	 	 	 dF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dGd&„Z?	 	 	 dH	 	 	 	 	 	 	 	 	 dId'„Z@	 	 	 dJ	 	 	 	 	 	 	 	 	 dKd(„ZA	 	 dL	 	 	 	 	 	 	 	 	 dMd)„ZB	 	 	 dN	 	 	 	 	 	 	 	 	 	 	 	 	 dOd*„ZC	 	 	 	 dP	 	 	 	 	 	 	 	 	 	 	 dQd+„ZD	 dR	 	 	 dSd,„ZEdTd-„ZFeF	 	 	 dU	 	 	 	 	 	 	 	 	 dVd.„«       ZGeF	 	 	 dU	 	 	 	 	 	 	 	 	 dVd/„«       ZHeF	 	 	 dU	 	 	 	 	 	 	 	 	 dVd0„«       ZIeF	 	 	 dU	 	 	 	 	 dWd1„«       ZJ	 	 	 	 	 	 dXd2„ZK	 	 	 	 	 	 dXd3„ZLeGeHd4œZMdYdZd5„ZNd[d6„ZO	 	 	 	 	 	 	 	 d\d7„ZPy)]z$
Routines for filling missing data.
é    )Úannotations)Úwraps)ÚTYPE_CHECKINGÚAnyÚLiteralÚcastÚoverloadN)Ú	is_nan_na)ÚNaTÚalgosÚlib)Ú	ArrayLikeÚAxisIntÚFÚReindexMethodÚnpt)Úimport_optional_dependency)Úinfer_dtype_from)Úis_array_likeÚis_bool_dtypeÚis_numeric_dtypeÚis_object_dtypeÚneeds_i8_conversion)Ú
ArrowDtypeÚBaseMaskedDtypeÚDatetimeTZDtype)Úis_valid_na_for_dtypeÚisnaÚna_value_for_dtype)ÚCallable)Ú	TypeAlias)ÚIndex)ú
not-a-knotÚclampedÚnaturalÚperiodicr!   Ú_CubicBCc                óv   — t        | «      r-t        | «      |k7  rt        dt        | «      › d|› �«      ‚| |   } | S )zJ
    Validate the size of the values passed to ExtensionArray.fillna.
    z'Length of 'value' does not match. Got (z)  expected )r   ÚlenÚ
ValueError)ÚvalueÚmaskÚlengths      úJ/var/www/html/acx/venv/lib/python3.12/site-packages/pandas/core/missing.pyÚcheck_value_sizer/   >   sP   € ô �UÔÜˆu‹:˜ÒÜØ9¼#¸e»*¸ð FØ#˜Hð&óð ð �d‘ˆà€Ló    c                ó  — t        |«      \  }}t        | j                  t        t        f«      �rt        j                  |«      �rt        j                  |«      rït        «       så| j                  j                  dk(  r�t        | j                  t        «      r3t        j                  | j                  «      | j                  «        z  }|S ddlm} |j                  | j                   «      j#                  d«      j%                  «       }|S | j                  j                  dv r't        j&                  | j(                  t*        ¬«      }|S t        |«      rt        | «      S t        j&                  | j(                  t*        ¬«      }t-        | j                  «      r-t/        | j                  «      st        j0                  |«      r	 |S t/        | j                  «      r#t-        |«      rt        j0                  |«      s	 |S t-        | j                  «      rt        |t2        «      r	 |S t5        | j                  «      rt        | «       }| |   |k(  ||<   |S | |k(  }t        |t        j6                  «      s|j%                  t*        d¬«      }|}|S )a?  
    Return a masking array of same size/shape as arr
    with entries equaling value set to True.

    Parameters
    ----------
    arr : ArrayLike
    value : scalar-like
        Caller has ensured `not is_list_like(value)` and that it can be held
        by `arr`.

    Returns
    -------
    np.ndarray[bool]
    Úfr   NFÚiu©Údtype)r5   Úna_value)r   Ú
isinstancer5   r   r   r   Úis_floatÚnpÚisnanr
   ÚkindÚ_datar   Úpyarrow.computeÚcomputeÚis_nanÚ	_pa_arrayÚ	fill_nullÚto_numpyÚzerosÚshapeÚboolr   r   Úis_boolÚstrr   Úndarray)Úarrr+   r5   r,   ÚpcÚarr_maskÚnew_masks          r.   Úmask_missingrM   M   sò  € ô  $ EÓ*�L€Eˆ5ô 	�3—9‘9œ´
Ð;Õ<Ü�L‰L˜ÕÜ�H‰H�UŒOÜ”ð �9‰9�>‰>˜SÒ ä˜#Ÿ)™)¤_Ô5ä—x‘x §	¡	Ó*¨c¯h©h«j¨[Ñ8�Ø�õ -à—y‘y §¡Ó/×9Ñ9¸%Ó@×IÑIÓK�Ø�à�Y‰Y�^‰^˜tÑ#ä—8‘8˜CŸI™I¬TÔ2ˆDØˆKäˆE„{Ü�C‹yÐô �8‰8�C—I‘I¤TÔ*€Dä˜Ÿ™Ô#Ü˜cŸi™iÔ(Ü�K‰K˜Ôð 	ð, €Kô) 	�c—i‘iÔ Ô%5°eÔ%<ÄSÇ[Á[ÐQVÔEWð 	ð" €Kô! 
˜#Ÿ)™)Ô	$¬°E¼3Ô)?àð €Kô 
˜Ÿ™Ô	#ô ˜“I�:ˆØ˜X™¨%Ñ/ˆˆX‰ð €Kð ˜%‘<ˆä˜(¤B§J¡JÔ/à×(Ñ(¬t¸eÐ(ÓDˆHØˆà€Kr0   .©Úallow_nearestc                ó   — y ©N© ©ÚmethodrO   s     r.   Úclean_fill_methodrU   œ   s   € ð
 "%r0   c                ó   — y rQ   rR   rS   s     r.   rU   rU   ¤   s   € ð
 -0r0   Fc               óÄ   — t        | t        «      r| j                  «       } | dk(  rd} n| dk(  rd} ddg}d}|r|j                  d«       d}| |vrt	        d|› d	| › �«      ‚| S )
NÚffillÚpadÚbfillÚbackfillzpad (ffill) or backfill (bfill)Únearestz(pad (ffill), backfill (bfill) or nearestzInvalid fill method. Expecting z. Got )r7   rG   ÚlowerÚappendr*   )rT   rO   Úvalid_methodsÚ	expectings       r.   rU   rU   ¬   s€   € ô
 �&œ#Ôð —‘“ˆØ�WÒØ‰FØ�wÒØˆFà˜JÐ'€MØ1€IÙØ×Ñ˜YÔ'Ø>ˆ	Ø�]Ñ"ÜÐ:¸9¸+ÀVÈFÈ8ÐTÓUÐUØ€Mr0   )ÚlinearÚtimeÚindexÚvalues)r\   ÚzeroÚslinearÚ	quadraticÚcubicÚbarycentricÚkroghÚsplineÚ
polynomialÚfrom_derivativesÚpiecewise_polynomialÚpchipÚakimaÚcubicsplinec                óÌ   — |j                  d«      }| dv r|€t        d«      ‚t        t        z   }| |vrt        d|› d| › d�«      ‚| dv r|j                  st        | › d�«      ‚| S )	NÚorder)rk   rl   z7You must specify the order of the spline or polynomial.zmethod must be one of z. Got 'z
' instead.)rj   rn   ro   z4 interpolation requires that the index be monotonic.)Úgetr*   Ú
NP_METHODSÚ
SP_METHODSÚis_monotonic_increasing)rT   rc   Úkwargsrs   Úvalids        r.   Úclean_interp_methodrz   Ü   s‡   € Ø�J‰J�wÓ€EàÐ)Ñ)¨e¨mÜÐRÓSÐSäœÑ#€EØ�UÑÜÐ1°%°¸À¸xÀzÐRÓSÐSàÐ;Ñ;Ø×,Ò,ÜØ�(ÐNÐOóð ð €Mr0   c                ó  — | dv sJ ‚t        |«      dk(  ry|j                  dk(  r|j                  d¬«      }| dk(  r|dd j                  «       }n*| dk(  r%t        |«      dz
  |ddd	…   j                  «       z
  }|   }|sy|S )
a+  
    Retrieves the positional index of the first valid value.

    Parameters
    ----------
    how : {'first', 'last'}
        Use this parameter to change between the first or last valid index.
    is_valid: np.ndarray
        Mask to find na_values.

    Returns
    -------
    int or None
    )ÚfirstÚlastr   Né   é   ©Úaxisr|   r}   éÿÿÿÿ)r)   ÚndimÚanyÚargmax)ÚhowÚis_validÚidxposÚ	chk_notnas       r.   Úfind_valid_indexrŠ   ï   s™   € ð Ð#Ñ#Ð#Ð#ä
ˆ8ƒ}˜ÒØà‡}�}˜Òà—<‘< Q�<Ó'ˆà
ˆg‚~Ø™"�×$Ñ$Ó&‰à	�ŠÜ�X“ Ñ" X©d°¨d¡^×%:Ñ%:Ó%<Ñ<ˆà˜Ñ €IáØð €Mr0   c                óZ   — g d¢}| j                  «       } | |vrt        d|› d| › d�«      ‚| S )N)ÚforwardÚbackwardÚbothz*Invalid limit_direction: expecting one of z, got 'z'.©r]   r*   )Úlimit_directionÚvalid_limit_directionss     r.   Úvalidate_limit_directionr’     sN   € ò =ÐØ%×+Ñ+Ó-€OØÐ4Ñ4ÜØ8Ø%Ð& g¨oÐ->¸bðBó
ð 	
ð Ðr0   c                ó^   — | �*ddg}| j                  «       } | |vrt        d|› d| › d�«      ‚| S )NÚinsideÚoutsidez%Invalid limit_area: expecting one of z, got ú.r�   )Ú
limit_areaÚvalid_limit_areass     r.   Úvalidate_limit_arear™   %  sV   € ØÐØ% yÐ1ÐØ×%Ñ%Ó'ˆ
ØÐ.Ñ.ÜØ7Ð8IÐ7JÈ&Ø�,˜að!óð ð Ðr0   c                ó‚   — | €|dv rd} | S d} | S |dv r| dk7  rt        d|› d�«      ‚|dv r| dk7  rt        d|› d�«      ‚| S )N)r[   rZ   r�   rŒ   )rY   rX   z0`limit_direction` must be 'forward' for method `ú`z1`limit_direction` must be 'backward' for method `)r*   )r�   rT   s     r.   Úinfer_limit_directionrœ   3  s�   € ð ÐØÐ*Ñ*Ø(ˆOð Ðð (ˆOð Ðð Ð%Ñ%¨/¸YÒ*FÜØBÀ6À(È!ÐLóð ð Ð*Ñ*¨À*Ò/LÜØCÀFÀ8È1ÐMóð ð Ðr0   c                ó   — | dk(  rddl m}  |t        |«      «      }nŒh d£}t        |j                  «      xs< t        |j                  t        «      xs  t        j                  |j                  d«      }t        t        z   }| |v r| |vr |st        d| › d�«      ‚t        d| › d	�«      ‚t        |«      j                  «       rt        d
«      ‚|S )Nra   r   )Ú
RangeIndex>   rb   rc   rd   r\   ÚmMz9Index column must be numeric or datetime type when using z_ method other than linear. Try setting a numeric or datetime index column before interpolating.ú Can not interpolate with method=r–   zkInterpolation with NaNs in the index has not been implemented. Try filling those NaNs before interpolating.)Úpandasrž   r)   r   r5   r7   r   r   Úis_np_dtyperu   rv   r*   r   r„   ÚNotImplementedError)rT   rc   rž   ÚmethodsÚis_numeric_or_datetimery   s         r.   Úget_interp_indexr¦   H  sØ   € à�Òå%áœ3˜u›:Ó&‰â8ˆä˜UŸ[™[Ó)ò 2Ü˜%Ÿ+™+¤Ó7ò2ä�‰˜uŸ{™{¨DÓ1ð 	ô
 œZÑ'ˆØ�U‰?Ø˜WÑ$Ñ-CÜ ðØ#˜Hð %%ð%óð ô Ð?À¸xÀqÐIÓJÐJäˆEƒ{‡�ÔÜ!ð/ó
ð 	
ð
 €Lr0   c	           	     ó�  ‡‡‡‡‡‡	‡‡— t        ‰|fi ‰	¤Ž t        ‰| j                  «      rt        | j                  d¬«      Š‰dk(  r"t	        |j                  «      st        d«      ‚dŠt        ‰«      Št        |«      Št        j                  d‰¬«      Št        |‰«      Šd	ˆˆˆ	ˆˆˆˆˆfd„}
t        j                  |
|| «       y)
zÝ
    Column-wise application of _interpolate_1d.

    Notes
    -----
    Alters 'data' in-place.

    The signature does differ from _interpolate_1d because it only
    includes what is needed for Block.interpolate.
    F)Úcompatrb   zStime-weighted interpolation only works on Series or DataFrames with a DatetimeIndexrd   N)ÚnobsÚlimitc                ó0   •— t        d‰| ‰‰‰‰‰d‰dœ	‰¤Ž y )NF)	ÚindicesÚyvaluesrT   rª   r�   r—   Ú
fill_valueÚbounds_errorr,   rR   )Ú_interpolate_1d)	r­   r®   r¬   rx   rª   Úlimit_area_validatedr�   r,   rT   s	    €€€€€€€€r.   Úfuncz$interpolate_2d_inplace.<locals>.func˜  s7   ø€ ô 	ð 	
ØØØØØ+Ø+Ø!ØØñ	
ð ó	
r0   )r­   ú
np.ndarrayÚreturnÚNone)rz   r   r5   r   r   r*   r’   r™   r   Úvalidate_limitÚ_index_to_interp_indicesr9   Úapply_along_axis)Údatarc   r�   rT   rª   r�   r—   r®   r,   rx   r²   r¬   r±   s      ``` ``` @@r.   Úinterpolate_2d_inplacerº   k  s²   ÿ€ ô. ˜ Ñ0¨Ò0ä˜Z¨¯©Ô4Ü'¨¯
©
¸5ÔAˆ
à�ÒÜ" 5§;¡;Ô/Üð óð ð
 ˆä.¨Ó?€OÜ.¨zÓ:Ðô × Ñ  d°%Ô8€Eä& u¨fÓ5€G÷
ô 
ô  ×Ñ˜˜d DÕ)r0   c                óF  — | j                   }t        |j                  «      r|j                  d«      }|dk(  r|}t	        t
        j                  |«      }|S t        j                  |«      }|dv r2|j                  t
        j                  k(  rt        j                  |«      }|S )zE
    Convert Index to ndarray of indices to pass to NumPy/SciPy.
    Úi8ra   )rd   rc   )Ú_valuesr   r5   Úviewr   r9   rH   ÚasarrayÚobject_r   Úmaybe_convert_objects)rc   rT   ÚxarrÚindss       r.   r·   r·   «  sˆ   € ð �=‰=€DÜ˜4Ÿ:™:Ô&à�y‰y˜‹ˆà�ÒØˆÜ”B—J‘J Ó%ˆð €Kô �z‰z˜$ÓˆàÐ(Ñ(Ø�z‰zœRŸZ™ZÒ'Ü×0Ñ0°Ó6�à€Kr0   c
                óÆ  — |	�|	}nt        |«      }| }|j                  «       sy|j                  «       ryt        j                  |«      }t        d|¬«      }|€d}t        j                  |«      }t        d|¬«      }|€t        |«      }t        j                  d|z   t        |«      «      }|dk(  r"t        j                  |t        ||d«      «      }nG|dk(  r"t        j                  |t        |d|«      «      }n t        j                  t        |||«      «      }|d	k(  r-t        j                  ||«      }t        j                  ||«      }nK|d
k(  rFt        j                  ||d¬«      }t        j                  ||d¬«      }t        j                  ||«      }|j                  j                  dv }|r|j                  d«      }|t        v rBt        j                   | |   «      }t        j"                  | |   | |   |   ||   |   «      ||<   nt%        | |   ||   | |   f||||dœ|
¤Ž||<   |	�d|	dd d|	|<   y|rt&        j(                  ||<   yt        j*                  ||<   y)a  
    Logic for the 1-d interpolation.  The input
    indices and yvalues will each be 1-d arrays of the same length.

    Bounds_error is currently hardcoded to False since non-scipy ones don't
    take it as an argument.

    Notes
    -----
    Fills 'yvalues' in-place.
    Nr|   )r†   r‡   r   r}   r   rŒ   r�   r”   r•   T©Úassume_uniquerŸ   r¼   )rT   r®   r¯   rs   F)r   r„   Úallr9   ÚflatnonzerorŠ   Úaranger)   Úunion1dÚ_interp_limitÚuniqueÚ	setdiff1dr5   r;   r¾   ru   ÚargsortÚinterpÚ_interpolate_scipy_wrapperr   r+   Únan)r¬   r­   rT   rª   r�   r—   r®   r¯   rs   r,   rx   Úinvalidry   Úall_nansÚfirst_valid_indexÚ
start_nansÚlast_valid_indexÚend_nansÚpreserve_nansÚmid_nansÚis_datetimelikeÚindexers                         r.   r°   r°   Á  sj  € ð0 ÐØ‰ä�w“-ˆØˆH€Eà�9‰9Œ;Øà‡y�y„{Øô �~‰~˜gÓ&€Hä(¨W¸uÔEÐØÐ ØÐÜ—‘Ð,Ó-€Jä'¨F¸UÔCÐØÐÜ˜w›<ÐÜ�y‰y˜Ð-Ñ-¬s°5«zÓ:€Hð ˜)Ò#ÜŸ
™
 :¬}¸WÀeÈQÓ/OÓP‰Ø	˜JÒ	&ÜŸ
™
 8¬]¸7ÀAÀuÓ-MÓN‰ô Ÿ	™	¤-°¸ÀÓ"FÓGˆð �XÒäŸ
™
 =°*Ó=ˆÜŸ
™
 =°(Ó;‰Ø	�yÒ	 ä—<‘< ¨*ÀDÔIˆÜ—<‘< ¨(À$ÔGˆÜŸ
™
 =°(Ó;ˆà—m‘m×(Ñ(¨DÐ0€OáØ—,‘,˜tÓ$ˆà”Ñô —*‘*˜W U™^Ó,ˆÜŸ9™9Ø�GÑ˜g e™n¨WÑ5°w¸u±~ÀgÑ7Nó
ˆ�Òô 6Ø�E‰NØ�E‰NØ�GÑð	
ð Ø!Ø%Øñ	
ð ñ	
ˆ�Ñð ÐØˆ‰QˆØ"ˆˆ]Ñð
 ñ	 
Ü!$§¡ˆ�Ñð ô "$§¡ˆ�ÑØ
r0   c                ó  — |› d�}t        d|¬«       ddlm}	 t        j                  |«      }|	j
                  |	j                  t        t        t        t        |	j                  dœ}
g d¢}||v r*|dk(  r|}n|}|	j                  | ||||¬	«      } ||«      }|S |d
k(  r>t        |«      s|dk  rt        d|› �«      ‚ |	j                  | |fd|i|¤Ž} ||«      }|S | j                  j                   s| j#                  «       } |j                  j                   s|j#                  «       }|j                  j                   s|j#                  «       }|
j%                  |d«      }|€t        d|› d�«      ‚|j'                  dd«        || ||fi |¤Ž}|S )zµ
    Passed off to scipy.interpolate.interp1d. method is scipy's kind.
    Returns an array interpolated at new_x.  Add any new methods to
    the list in _clean_interp_method.
    z interpolation requires SciPy.Úscipy)Úextrar   ©Úinterpolate)ri   rj   rm   rn   rq   rp   ro   )r\   re   rf   rg   rh   rl   rl   )r;   r®   r¯   rk   z;order needs to be specified and greater than 0; got order: ÚkNr    r–   Údowncast)r   rÝ   rà   r9   r¿   Úbarycentric_interpolateÚkrogh_interpolateÚ_from_derivativesÚ_cubicspline_interpolateÚ_akima_interpolateÚpchip_interpolateÚinterp1dr   r*   ÚUnivariateSplineÚflagsÚ	writeableÚcopyrt   Úpop)ÚxÚyÚnew_xrT   r®   r¯   rs   rx   rÞ   rà   Úalt_methodsÚinterp1d_methodsr;   ÚterpÚnew_ys                  r.   rÐ   rÐ   1  s­  € ð ˆhÐ4Ð5€EÜ˜w¨eÕ4Ý!ä�J‰J�uÓ€Eð #×:Ñ:Ø×.Ñ.Ü-Ü 1Ü/Ü#Ø×.Ñ.ñ9€KòÐð Ð!Ñ!Ø�\Ò!Ø‰DàˆDØ×#Ñ#Øˆq�t¨
Àð $ó 
ˆñ �U“ˆð2 €Lð1 
�8Ò	ä�Œ;˜5 Aš:ÜØMÈeÈWÐUóð ð ,ˆ{×+Ñ+¨A¨qÑD°EÐD¸VÑDˆÙ�U“ˆð" €Lð �w‰w× Ò Ø—‘“ˆAØ�w‰w× Ò Ø—‘“ˆAØ�{‰{×$Ò$Ø—J‘J“LˆEØ�‰˜v tÓ,ˆØˆ<ÜÐ?À¸xÀqÐIÓJÐJð 	�
‰
�:˜tÔ$Ù�Q˜˜5Ñ+ FÑ+ˆØ€Lr0   c                ó‚   — ddl m} |j                  j                  } || |j	                  dd«      ||¬«      } ||«      S )aŸ  
    Convenience function for interpolate.BPoly.from_derivatives.

    Construct a piecewise polynomial in the Bernstein basis, compatible
    with the specified values and derivatives at breakpoints.

    Parameters
    ----------
    xi : array-like
        sorted 1D array of x-coordinates
    yi : array-like or list of array-likes
        yi[i][j] is the j-th derivative known at xi[i]
    order: None or int or array-like of ints. Default: None.
        Specifies the degree of local polynomials. If not None, some
        derivatives are ignored.
    der : int or list
        How many derivatives to extract; None for all potentially nonzero
        derivatives (that is a number equal to the number of points), or a
        list of derivatives to extract. This number includes the function
        value as 0th derivative.
     extrapolate : bool, optional
        Whether to extrapolate to ouf-of-bounds points based on first and last
        intervals, or to return NaNs. Default: True.

    See Also
    --------
    scipy.interpolate.BPoly.from_derivatives

    Returns
    -------
    y : scalar or array-like
        The result, of length R or length M or M by R.
    r   rß   r‚   r   )ÚordersÚextrapolate)rÝ   rà   ÚBPolyrm   Úreshape)	ÚxiÚyirï   rs   Úderrø   rà   rT   Úms	            r.   rå   rå   ~  s?   € õR "ð ×Ñ×/Ñ/€FÙˆr�2—:‘:˜b !Ó$¨UÀÔL€AáˆQ‹4€Kr0   c                óJ   — ddl m} |j                  | ||¬«      } |||¬«      S )a½  
    Convenience function for akima interpolation.
    xi and yi are arrays of values used to approximate some function f,
    with ``yi = f(xi)``.

    See `Akima1DInterpolator` for details.

    Parameters
    ----------
    xi : np.ndarray
        A sorted list of x-coordinates, of length N.
    yi : np.ndarray
        A 1-D array of real values.  `yi`'s length along the interpolation
        axis must be equal to the length of `xi`. If N-D array, use axis
        parameter to select correct axis.
    x : np.ndarray
        Of length M.
    der : int, optional
        How many derivatives to extract. This number includes the function
        value as 0th derivative.
    axis : int, optional
        Axis in the yi array corresponding to the x-coordinate values.

    See Also
    --------
    scipy.interpolate.Akima1DInterpolator

    Returns
    -------
    y : scalar or array-like
        The result, of length R or length M or M by R,

    r   rß   r€   )Únu)rÝ   rà   ÚAkima1DInterpolator)rû   rü   rï   rý   r�   rà   ÚPs          r.   rç   rç   °  s+   € õP "à×'Ñ'¨¨B°TÐ'Ó:€AáˆQ�3Œ<Ðr0   c                óJ   — ddl m} |j                  | ||||¬«      } ||«      S )ag  
    Convenience function for cubic spline data interpolator.

    See `scipy.interpolate.CubicSpline` for details.

    Parameters
    ----------
    xi : np.ndarray, shape (n,)
        1-d array containing values of the independent variable.
        Values must be real, finite and in strictly increasing order.
    yi : np.ndarray
        Array containing values of the dependent variable. It can have
        arbitrary number of dimensions, but the length along ``axis``
        (see below) must match the length of ``x``. Values must be finite.
    x : np.ndarray, shape (m,)
    axis : int, optional
        Axis along which `y` is assumed to be varying. Meaning that for
        ``x[i]`` the corresponding values are ``np.take(y, i, axis=axis)``.
        Default is 0.
    bc_type : string or 2-tuple, optional
        Boundary condition type. Two additional equations, given by the
        boundary conditions, are required to determine all coefficients of
        polynomials on each segment [2]_.
        If `bc_type` is a string, then the specified condition will be applied
        at both ends of a spline. Available conditions are:
        * 'not-a-knot' (default): The first and second segment at a curve end
          are the same polynomial. It is a good default when there is no
          information on boundary conditions.
        * 'periodic': The interpolated functions is assumed to be periodic
          of period ``x[-1] - x[0]``. The first and last value of `y` must be
          identical: ``y[0] == y[-1]``. This boundary condition will result in
          ``y'[0] == y'[-1]`` and ``y''[0] == y''[-1]``.
        * 'clamped': The first derivative at curves ends are zero. Assuming
          a 1D `y`, ``bc_type=((1, 0.0), (1, 0.0))`` is the same condition.
        * 'natural': The second derivative at curve ends are zero. Assuming
          a 1D `y`, ``bc_type=((2, 0.0), (2, 0.0))`` is the same condition.
        If `bc_type` is a 2-tuple, the first and the second value will be
        applied at the curve start and end respectively. The tuple values can
        be one of the previously mentioned strings (except 'periodic') or a
        tuple `(order, deriv_values)` allowing to specify arbitrary
        derivatives at curve ends:
        * `order`: the derivative order, 1 or 2.
        * `deriv_value`: array-like containing derivative values, shape must
          be the same as `y`, excluding ``axis`` dimension. For example, if
          `y` is 1D, then `deriv_value` must be a scalar. If `y` is 3D with
          the shape (n0, n1, n2) and axis=2, then `deriv_value` must be 2D
          and have the shape (n0, n1).
    extrapolate : {bool, 'periodic', None}, optional
        If bool, determines whether to extrapolate to out-of-bounds points
        based on first and last intervals, or to return NaNs. If 'periodic',
        periodic extrapolation is used. If None (default), ``extrapolate`` is
        set to 'periodic' for ``bc_type='periodic'`` and to True otherwise.

    See Also
    --------
    scipy.interpolate.CubicHermiteSpline

    Returns
    -------
    y : scalar or array-like
        The result, of shape (m,)

    References
    ----------
    .. [1] `Cubic Spline Interpolation
            <https://en.wikiversity.org/wiki/Cubic_Spline_Interpolation>`_
            on Wikiversity.
    .. [2] Carl de Boor, "A Practical Guide to Splines", Springer-Verlag, 1978.
    r   rß   )r�   Úbc_typerø   )rÝ   rà   ÚCubicSpline)rû   rü   rï   r�   r  rø   rà   r  s           r.   ræ   ræ   ß  s3   € õZ "à×ÑØ
ˆB�T 7¸ð 	 ó 	€Añ ˆQ‹4€Kr0   c                óì   — |dk(  rd„ nd„ }| j                   dk(  r/|dk7  rt        d«      ‚| j                  dg| j                  ¢­«      } t	        |«      } || «      }t        |d¬«      } ||||¬«       y	)
a  
    Perform an actual interpolation of values, values will be make 2-d if
    needed fills inplace, returns the result.

    Parameters
    ----------
    values: np.ndarray
        Input array.
    method: str, default "pad"
        Interpolation method. Could be "bfill" or "pad"
    axis: 0 or 1
        Interpolation axis
    limit: int, optional
        Index limit on interpolation.
    limit_area: str, optional
        Limit area for interpolation. Can be "inside" or "outside"

    Notes
    -----
    Modifies values in-place.
    r   c                ó   — | S rQ   rR   ©rï   s    r.   ú<lambda>z)pad_or_backfill_inplace.<locals>.<lambda>Q  s   € ˜€ r0   c                ó   — | j                   S rQ   )ÚTr  s    r.   r	  z)pad_or_backfill_inplace.<locals>.<lambda>Q  s
   € ¸¿¹€ r0   r   z1cannot interpolate on an ndim == 1 with axis != 0r~   )rƒ   )rª   r—   N)rƒ   ÚAssertionErrorrú   rD   rU   Úget_fill_func)rd   rT   r�   rª   r—   ÚtransfÚtvaluesr²   s           r.   Úpad_or_backfill_inplacer  5  sw   € ð8 # ašiŠk©m€Fð ‡{�{�aÒØ�1Š9Ü Ð!TÓUÐUØ—‘ Ð 2 V§\¡\Ñ 2Ó3ˆä˜vÓ&€FÙ�V‹n€Gä˜ aÔ(€Dáˆ˜¨*Ö5r0   c                ó    — |€t        | «      }|S rQ   )r   )rd   r,   s     r.   Ú_fillna_prepr  a  s   € ð
 €|Ü�F‹|ˆà€Kr0   c                óZ   ‡ — t        ‰ «      	 	 	 d	 	 	 dˆ fd„«       }t        t        |«      S )z>
    Wrapper to handle datetime64 and timedelta64 dtypes.
    c                óÖ   •— t        | j                  «      rH|€t        | «      } ‰| j                  d«      |||¬«      \  }}|j                  | j                  «      |fS  ‰| |||¬«      S )Nr¼   )rª   r—   r,   )r   r5   r   r¾   )rd   rª   r—   r,   Úresultr²   s        €r.   Únew_funcz&_datetimelike_compat.<locals>.new_funcq  sj   ø€ ô ˜vŸ|™|Ô,Øˆ|ä˜F“|�áØ—‘˜DÓ!¨¸:ÈDô‰LˆF�Dð —;‘;˜vŸ|™|Ó,¨dÐ2Ð2á�F %°JÀTÔJÐJr0   ©NNN)rª   ú
int | Noner—   ú#Literal['inside', 'outside'] | None)r   r   r   )r²   r  s   ` r.   Ú_datetimelike_compatr  l  sK   ø€ ô
 ˆ4ƒ[ð !Ø:>Øð	KàðKð 8ôKó ðKô$ ”�8ÓÐr0   c                óŽ   — t        | |«      }|�|j                  «       st        ||«       t        j                  | ||¬«       | |fS ©N)rª   )r  rÇ   Ú_fill_limit_area_1dr   Úpad_inplace©rd   rª   r—   r,   s       r.   Ú_pad_1dr   ‡  sD   € ô ˜ Ó%€DØÐ d§h¡h¤jÜ˜D *Ô-Ü	×Ñ�f˜d¨%Õ0Ø�4ˆ<Ðr0   c                óŽ   — t        | |«      }|�|j                  «       st        ||«       t        j                  | ||¬«       | |fS r  )r  rÇ   r  r   Úbackfill_inplacer  s       r.   Ú_backfill_1dr#  •  sD   € ô ˜ Ó%€DØÐ d§h¡h¤jÜ˜D *Ô-Ü	×Ñ˜6 4¨uÕ5Ø�4ˆ<Ðr0   c                ó†   — t        | |«      }|�t        ||«       | j                  rt        j                  | ||¬«       | |fS r  )r  Ú_fill_limit_area_2dÚsizer   Úpad_2d_inplacer  s       r.   Ú_pad_2dr(  £  sC   € ô ˜ Ó%€DØÐÜ˜D *Ô-à‡{‚{Ü×Ñ˜V T°Õ7Ø�4ˆ<Ðr0   c                ó�   — t        | |«      }|�t        ||«       | j                  rt        j                  | ||¬«       | |fS 	 | |fS r  )r  r%  r&  r   Úbackfill_2d_inplacer  s       r.   Ú_backfill_2dr+  ³  sT   € ô ˜ Ó%€DØÐÜ˜D *Ô-à‡{‚{Ü×!Ñ! &¨$°eÕ<ð �4ˆ<Ðð 	Ø�4ˆ<Ðr0   c                ó¶   — |  }|j                  «       }t        |«      |ddd…   j                  «       z
  dz
  }|dk(  rd| d| d| |dz   d y|dk(  r	d| |dz   | yy)a×  Prepare 1d mask for ffill/bfill with limit_area.

    Caller is responsible for checking at least one value of mask is False.
    When called, mask will no longer faithfully represent when
    the corresponding are NA or not.

    Parameters
    ----------
    mask : np.ndarray[bool, ndim=1]
        Mask representing NA values when filling.
    limit_area : { "outside", "inside" }
        Whether to limit filling to outside or inside the outer most non-NA value.
    Nr‚   r   r”   Fr•   )r…   r)   )r,   r—   Úneg_maskr|   r}   s        r.   r  r  Æ  s{   € ð  ˆu€HØ�O‰OÓ€EÜˆx‹=˜8¡D b D™>×0Ñ0Ó2Ñ2°QÑ6€DØ�XÒØˆˆVˆeˆØ ˆˆT�A‰XˆZÑØ	�yÒ	 Ø!&ˆˆU�Q‰Y˜Ñð 
!r0   c                óˆ  — | j                    }|dk(  rPt        j                  j                  |d¬«      t        j                  j                  |ddd…   d¬«      ddd…   z  }nQt        j                  j                  |d¬«       t        j                  j                  |ddd…   d¬«      ddd…    z  }d| |j                   <   y)a‹  Prepare 2d mask for ffill/bfill with limit_area.

    When called, mask will no longer faithfully represent when
    the corresponding are NA or not.

    Parameters
    ----------
    mask : np.ndarray[bool, ndim=1]
        Mask representing NA values when filling.
    limit_area : { "outside", "inside" }
        Whether to limit filling to outside or inside the outer most non-NA value.
    r•   r   r€   Nr‚   F)r  r9   ÚmaximumÚ
accumulate)r,   r—   r-  Úla_masks       r.   r%  r%  à  sÄ   € ð —‘ˆw€HØ�YÒô �J‰J×!Ñ! (°Ð!Ó3Ü�j‰j×#Ñ# H©T¨r¨T¡N¸Ð#Ó;¹D¸b¸DÑAñBñ 	ô �Z‰Z×"Ñ" 8°!Ð"Ó4Ð4Ü�z‰z×$Ñ$ X©d°¨d¡^¸!Ð$Ó<¹T¸r¸TÑBÐBñCð 	ð €Dˆ�‰‚Or0   ©rY   r[   c                óT   — t        | «      } |dk(  r	t        |    S t        t        dœ|    S )Nr   r2  )rU   Ú_fill_methodsr(  r+  )rT   rƒ   s     r.   r  r    s.   € Ü˜vÓ&€FØˆq‚yÜ˜VÑ$Ð$Ü¬Ñ5°fÑ=Ð=r0   c                ó"   — | €y t        | d¬«      S )NTrN   )rU   )rT   s    r.   Úclean_reindex_fill_methodr6  	  s   € Ø€~ØÜ˜V°4Ô8Ð8r0   c                óŽ  ‡— t        | «      Št        j                  g t        j                  ¬«      }t        j                  g t        j                  ¬«      }d}d
ˆfd„}|�)|dk(  rt        j                  | «      d   }d}n	 || |«      }|�#|dk(  r|S ‰dz
   || ddd…   |«      z
  }|dk(  r|S t        j
                  |||¬	«      S )am  
    Get indexers of values that won't be filled
    because they exceed the limits.

    Parameters
    ----------
    invalid : np.ndarray[bool]
    fw_limit : int or None
        forward limit to index
    bw_limit : int or None
        backward limit to index

    Returns
    -------
    set of indexers

    Notes
    -----
    This is equivalent to the more readable, but slower

    .. code-block:: python

        def _interp_limit(invalid, fw_limit, bw_limit):
            for x in np.where(invalid)[0]:
                if invalid[max(0, x - fw_limit) : x + bw_limit + 1].all():
                    yield x
    r4   Tc           	     óR  •— t        |‰«      }t        j                  j                  j	                  | |dz   «      j                  d«      }t        j                  t        j                  |«      d   |z   t        j                  | d |dz     j                  «       dk(  «      d   «      }|S )Nr   r   )	Úminr9   r   Ústride_tricksÚsliding_window_viewrÇ   rÊ   ÚwhereÚcumsum)rÒ   rª   ÚwindowedÚidxÚNs       €r.   Úinnerz_interp_limit.<locals>.inner5  s’   ø€ Ü�E˜1“ˆÜ—6‘6×'Ñ'×;Ñ;¸GÀUÈQÁYÓO×SÑSÐTUÓVˆÜ�j‰jÜ�H‰H�XÓ˜qÑ! EÑ)Ü�H‰H�w˜{ ¨¡Ð+Ð+×3Ñ3Ó5¸Ñ:Ó;¸AÑ>ó
ˆð ˆ
r0   Nr   Fr   r‚   rÅ   )rª   Úint)r)   r9   ÚarrayÚint64r<  Úintersect1d)rÒ   Úfw_limitÚbw_limitÚf_idxÚb_idxrÆ   rA  r@  s          @r.   rË   rË     sÄ   ø€ ôB 	ˆG‹€AÜ�H‰H�RœrŸx™xÔ(€EÜ�H‰H�RœrŸx™xÔ(€EØ€Mõð ÐØ�qŠ=Ü—H‘H˜WÓ% aÑ(ˆEØ!‰Má˜' 8Ó,ˆEàÐØ�qŠ=ð ˆLà˜‘E™E '©$¨B¨$¡-°Ó:Ñ:ˆEØ˜1Š}Ø�ä�>‰>˜% °mÔDÐDr0   )r,   únpt.NDArray[np.bool_]r-   rB  )rI   r   r´   rJ  )rT   z,Literal['ffill', 'pad', 'bfill', 'backfill']rO   zLiteral[False]r´   úLiteral['pad', 'backfill'])rT   ú7Literal['ffill', 'pad', 'bfill', 'backfill', 'nearest']rO   zLiteral[True]r´   ú%Literal['pad', 'backfill', 'nearest'])rT   rL  rO   rE   r´   rM  )rT   rG   rc   r"   r´   rG   )r†   rG   r‡   rJ  r´   r  )r�   rG   r´   z&Literal['forward', 'backward', 'both'])r—   ú
str | Noner´   r  )r�   z-Literal['backward', 'forward', 'both'] | NonerT   rG   r´   z&Literal['backward', 'forward', 'both'])rc   r"   r´   r"   )ra   NrŒ   NNN)r¹   r³   rc   r"   r�   r   rT   rG   rª   r  r�   rG   r—   rN  r®   ú
Any | Noner´   rµ   )rc   r"   rT   rG   r´   r³   )ra   NrŒ   NNFNN)r¬   r³   r­   r³   rT   rG   rª   r  r�   rG   r—   r  r®   rO  r¯   rE   rs   r  r´   rµ   )NFN)
rï   r³   rð   r³   rñ   r³   rT   rG   r¯   rE   )Nr   F)
rû   r³   rü   r³   rï   r³   rý   zint | list[int] | Nonerø   rE   )r   r   )
rû   r³   rü   r³   rï   r³   rý   rB  r�   r   )r   r#   N)rû   r³   rü   r³   rï   r³   r�   r   r  z_CubicBC | tuple[Any, Any]rø   z!Literal['periodic'] | bool | Noner´   r³   )rY   r   NN)rd   r³   rT   rK  r�   r   rª   r  r—   r  r´   rµ   rQ   )r,   únpt.NDArray[np.bool_] | Noner´   rJ  )r²   r   r´   r   r  )
rd   r³   rª   r  r—   r  r,   rP  r´   z(tuple[np.ndarray, npt.NDArray[np.bool_]])rª   r  r—   r  r,   rP  )r,   rJ  r—   zLiteral['outside', 'inside']r´   rµ   )r   )rƒ   rB  )r´   zReindexMethod | None)rÒ   rJ  rF  r  rG  r  r´   r³   )QÚ__doc__Ú
__future__r   Ú	functoolsr   Útypingr   r   r   r   r	   Únumpyr9   Úpandas._configr
   Úpandas._libsr   r   r   Úpandas._typingr   r   r   r   r   Úpandas.compat._optionalr   Úpandas.core.dtypes.castr   Úpandas.core.dtypes.commonr   r   r   r   r   Úpandas.core.dtypes.dtypesr   r   r   Úpandas.core.dtypes.missingr   r   r   Úcollections.abcr    r!   r¡   r"   r'   Ú__annotations__r/   rM   rU   ru   rv   rz   rŠ   r’   r™   rœ   r¦   rº   r·   r°   rÐ   rå   rç   ræ   r  r  r  r   r#  r(  r+  r  r%  r4  r  r6  rË   rR   r0   r.   ú<module>r`     s�  ðòõ #å ÷õ ó å $÷ñ ÷
õ õ ?å 4÷õ ÷ñ ÷
ñ ñ Ý(Ý åà!Ð"PÑQ€HˆiÓQóóLð^ 
ð %(ñ%Ø8ð%ð "ð%ð  ò	%ó 
ð%ð 
ð0ØCð0ð !ð0ð +ò	0ó 
ð0ð  ñØCðð ðð +ó	ò4 3€
ò€
ó$ó&$ðNØðà+óóðØBðØLOðà+óó* ðN ØØ$Ø!Ø!Ø	ð=*Ø
ð=*àð=*ð ð=*ð ð	=*ð
 ð=*ð ð=*ð ð=*ð ð=*ð 
ó=*ó@ð2 ØØ$Ø6:Ø!ØØØ	ðmØðmàðmð ðmð ð	mð
 ðmð 4ðmð ðmð ðmð ðmð 
ómðj ØØ
ðJØðJàðJð ðJð ð	Jð óJðb Ø"#Øð/Øð/àð/ð ð/ð
 
 ð/ð ó/ðl Øð,Øð,àð,ð ð,ð 
ð	,ð
 ó,ðf Ø*6Ø59ðSØðSàðSð ðSð ð	Sð
 (ðSð 3ðSð óSðp */ØØØ6:ð)6Øð)6à&ð)6ð ð)6ð ð	)6ð
 4ð)6ð 
ó)6ðZ 26ðØ.ðàóóð6 ð Ø6:Ø)-ð	
Øð
àð
ð 4ð
ð 'ð	
ð
 .ò
ó ð
ð ð Ø6:Ø)-ð	
Øð
àð
ð 4ð
ð 'ð	
ð
 .ò
ó ð
ð ð Ø6:Ø)-ð	Øðàðð 4ðð 'ð	ð
 .òó ðð ð Ø6:Ø)-ð	àðð 4ðð 'ò	ó ðð$'Ø
ð'Ø-Ið'à	ó'ð4Ø
ðØ-Iðà	óð>  ¨\Ñ:€ô>ó9ð@EØ"ð@EØ.8ð@EØDNð@Eàô@Er0   