Ë
    ¤ehÆ‰  ã                  ó   — 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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 m!Z! ddl"m#Z# ddl$m%Z%m&Z&m'Z' erddl(m)Z) d4d„Z*d5d„Z+e
ddœ	 	 	 	 	 d6d„«       Z,e
	 	 	 	 	 	 d7d„«       Z,ddœ	 	 	 	 	 d8d„Z,g d¢Z-g d¢Z.d9d„Z/d:d„Z0	 	 	 	 d;d„Z1d<d„Z2	 	 	 	 	 	 d=d„Z3d>d„Z4	 	 	 	 	 	 d?	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d@d„Z5dAd„Z6	 	 	 	 	 	 	 	 dB	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dCd „Z7	 	 	 dD	 	 	 	 	 	 	 	 	 dEd!„Z8	 	 	 dF	 	 	 	 	 	 	 	 	 dGd"„Z9	 	 dH	 	 	 	 	 	 	 	 	 dId#„Z:	 	 	 dJ	 	 	 	 	 	 	 	 	 dKd$„Z;	 	 	 	 	 	 	 	 	 	 dLd%„Z<	 	 	 	 dM	 	 	 	 	 	 	 	 	 	 	 dNd&„Z=	 dO	 	 	 dPd'„Z>dQd(„Z?e?	 	 	 dR	 	 	 	 	 	 	 	 	 dSd)„«       Z@e?	 	 	 dR	 	 	 	 	 	 	 	 	 dSd*„«       ZAe?	 	 	 dR	 	 	 	 	 	 	 dTd+„«       ZBe?	 	 	 dR	 	 	 	 	 dUd,„«       ZC	 	 	 	 	 	 dVd-„ZD	 	 	 	 	 	 dVd.„ZEe@eAd/œZFdWdXd0„ZGdYd1„ZH	 	 	 	 	 	 dZd2„ZId[d3„ZJy)\z$
Routines for filling missing data.
é    )Úannotations)Úwraps)ÚTYPE_CHECKINGÚAnyÚLiteralÚcastÚoverloadN)ÚNaTÚalgosÚlib)Ú	ArrayLikeÚAxisIntÚFÚReindexMethodÚnpt)Úimport_optional_dependency)Úinfer_dtype_from)Úis_array_likeÚis_bool_dtypeÚis_numeric_dtypeÚis_numeric_v_string_likeÚis_object_dtypeÚneeds_i8_conversion)ÚDatetimeTZDtype)Úis_valid_na_for_dtypeÚisnaÚna_value_for_dtype©ÚIndexc                ó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      úQ/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/pandas/core/missing.pyÚcheck_value_sizer'   3   sP   € ô �UÔÜˆu‹:˜ÒÜØ9¼#¸e»*¸ð FØ#˜Hð&óð ð �d‘ˆà€Ló    c                ó  — t        |«      \  }}t        |t        j                  «      rt        j                  ||¬«      }n<|j                  «       }t        j                  |«      s|g}|j                  ||d¬«      }d}t        | j                  «      rd}t        | «       }t        |«      }||    }t        j                  | j                  t        ¬«      }t        | j                  «      r+t        | j                  «      st        |j                  «      rnÌt        | j                  «      r+t        |j                  «      rt        |j                  «      snŒ|D ]‡  }	t!        | |	«      rŒ|r;t        j                  | j                  t        j"                  ¬«      }
|    |	k(  |
|<   n6| |	k(  }
t        |
t        j$                  «      s|
j'                  t        d¬«      }
||
z  }Œ‰ |j)                  «       r|t        | «      z  }|S )a	  
    Return a masking array of same size/shape as arr
    with entries equaling any member of values_to_mask set to True

    Parameters
    ----------
    arr : ArrayLike
    values_to_mask: list, tuple, or scalar

    Returns
    -------
    np.ndarray[bool]
    )ÚdtypeF)r*   ÚcopyT)r*   Úna_value)r   Ú
isinstanceÚnpr*   ÚarrayÚconstruct_array_typer   Úis_list_likeÚ_from_sequencer   r   ÚzerosÚshapeÚboolr   r   r   Úbool_ÚndarrayÚto_numpyÚany)ÚarrÚvalues_to_maskr*   ÚclsÚpotential_naÚarr_maskÚna_maskÚnonnar$   ÚxÚnew_masks              r&   Úmask_missingrC   B   s¥  € ô" -¨^Ó<Ñ€Eˆ>ä�%œŸ™Ô"ÜŸ™ .¸Ô>‰à×(Ñ(Ó*ˆÜ×Ñ Ô/Ø,Ð-ˆNØ×+Ñ+¨NÀ%ÈeÐ+ÓTˆà€LÜ�s—y‘yÔ!àˆÜ˜“I�:ˆä�>Ó"€GØ˜G˜8Ñ$€Eô �8‰8�C—I‘I¤TÔ*€Dä˜Ÿ™Ô#Ü˜cŸi™iÔ(Ü˜%Ÿ+™+Ô&àä�c—i‘iÔ Ü˜UŸ[™[Ô)Ü˜eŸk™kÔ*ààò 	!ˆAÜ'¨¨QÔ/àáÜ!Ÿx™x¨¯	©	¼¿¹ÔB�HØ),¨X©¸!Ñ);�H˜XÒ&à" a™x�Hä% h´·
±
Ô;à#+×#4Ñ#4¼4È%Ð#4Ó#P˜Ø˜Ñ ‘ð	!ð  ‡{�{„}Ø”�S“	Ñˆà€Kr(   .©Úallow_nearestc                ó   — y ©N© ©ÚmethodrE   s     r&   Úclean_fill_methodrK   ‹   ó   € ð r(   c                ó   — y rG   rH   rI   s     r&   rK   rK   ”   rL   r(   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 )r-   ÚstrÚlowerÚappendr"   )rJ   rE   Úvalid_methodsÚ	expectings       r&   rK   rK   �   s€   € ô
 �&œ#Ôð —‘“ˆØ�WÒØ‰FØ�wÒØˆFà˜JÐ'€MØ1€IÙØ×Ñ˜YÔ'Ø>ˆ	Ø�]Ñ"ÜÐ:¸9¸+ÀVÈFÈ8ÐTÓUÐUØ€Mr(   )ÚlinearÚtimeÚindexÚvalues)rS   Ú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)rc   rd   z7You must specify the order of the spline or polynomial.zmethod must be one of z. Got 'z
' instead.)rb   rf   rg   z4 interpolation requires that the index be monotonic.)Úgetr"   Ú
NP_METHODSÚ
SP_METHODSÚis_monotonic_increasing)rJ   r[   Úkwargsrk   Úvalids        r&   Úclean_interp_methodrr   Í   s‡   € Ø�J‰J�wÓ€EàÐ)Ñ)¨e¨mÜÐRÓSÐSäœÑ#€EØ�UÑÜÐ1°%°¸À¸xÀzÐRÓSÐSàÐ;Ñ;Ø×,Ò,ÜØ�(ÐNÐOóð ð €Mr(   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é   é   ©Úaxisrt   ru   éÿÿÿÿ)r!   Úndimr9   Úargmax)ÚhowÚis_validÚidxposÚ	chk_notnas       r&   Úfind_valid_indexr�   à   s™   € ð Ð#Ñ#Ð#Ð#ä
ˆ8ƒ}˜ÒØà‡}�}˜ÒØ—<‘< Q�<Ó'ˆà
ˆg‚~Ø™"�×$Ñ$Ó&‰à	�ŠÜ�X“ Ñ" X©d°¨d¡^×%:Ñ%:Ó%<Ñ<ˆà˜Ñ €IáØð €Mr(   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'.©rU   r"   )Úlimit_directionÚvalid_limit_directionss     r&   Úvalidate_limit_directionr‰     sN   € ò =ÐØ%×+Ñ+Ó-€OØÐ4Ñ4ÜØ8Ø%Ð& g¨oÐ->¸bðBó
ð 	
ð Ðr(   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ð!óð ð Ðr(   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)rR   rQ   r„   rƒ   )rP   rO   z0`limit_direction` must be 'forward' for method `ú`z1`limit_direction` must be 'backward' for method `)r"   )r‡   rJ   s     r&   Úinfer_limit_directionr“   #  s�   € ð ÐØÐ*Ñ*Ø(ˆOð Ðð (ˆOð Ðð Ð%Ñ%¨/¸YÒ*FÜØBÀ6À(È!ÐLóð ð Ð*Ñ*¨À*Ò/LÜØCÀFÀ8È1ÐMóð ð Ðr(   c                ó†  — | dk(  r+ddl m}  |t        j                  t	        |«      «      «      }nlh d£}t        |j                  «      xs< t        |j                  t        «      xs  t        j                  |j                  d«      }| |vr|st        d| › d�«      ‚t        |«      j                  «       rt        d«      ‚|S )	NrY   r   r   >   rZ   r[   r\   rS   Ú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.zkInterpolation with NaNs in the index has not been implemented. Try filling those NaNs before interpolating.)Úpandasr   r.   Úaranger!   r   r*   r-   r   r   Úis_np_dtyper"   r   r9   ÚNotImplementedError)rJ   r[   r   ÚmethodsÚis_numeric_or_datetimes        r&   Úget_interp_indexrœ   8  s»   € à�Òå á”b—i‘i¤ E£
Ó+Ó,‰â8ˆä˜UŸ[™[Ó)ò 2Ü˜%Ÿ+™+¤Ó7ò2ä�‰˜uŸ{™{¨DÓ1ð 	ð
 ˜Ñ Ñ)?ÜðØ˜ð !!ð!óð ô ˆEƒ{‡�ÔÜ!ð/ó
ð 	
ð
 €Lr(   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)ÚcompatrZ   zStime-weighted interpolation only works on Series or DataFrames with a DatetimeIndexr\   N)ÚnobsÚlimitc                ó0   •— t        d‰| ‰‰‰‰‰d‰dœ	‰¤Ž y )NF)	ÚindicesÚyvaluesrJ   r    r‡   rŽ   Ú
fill_valueÚbounds_errorr$   rH   )Ú_interpolate_1d)	r£   r¤   r¢   rp   r    Úlimit_area_validatedr‡   r$   rJ   s	    €€€€€€€€r&   Úfuncz$interpolate_2d_inplace.<locals>.func„  s7   ø€ ô 	ð 	
ØØØØØ+Ø+Ø!ØØñ	
ð ó	
r(   )r£   ú
np.ndarrayÚreturnÚNone)rr   r   r*   r   r   r"   r‰   r�   r   Úvalidate_limitÚ_index_to_interp_indicesr.   Úapply_along_axis)Údatar[   ry   rJ   r    r‡   rŽ   r¤   r$   rp   r¨   r¢   r§   s      ``` ``` @@r&   Úinterpolate_2d_inplacer°   W  s²   ÿ€ ô. ˜ Ñ0¨Ò0ä˜Z¨¯©Ô4Ü'¨¯
©
¸5ÔAˆ
à�ÒÜ" 5§;¡;Ô/Üð óð ð
 ˆä.¨Ó?€OÜ.¨zÓ:Ðô × Ñ  d°%Ô8€Eä& u¨fÓ5€G÷
ô 
ô, ×Ñ˜˜d DÕ)r(   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.
    Úi8rY   )r\   r[   )Ú_valuesr   r*   Úviewr   r.   r7   ÚasarrayÚobject_r   Úmaybe_convert_objects)r[   rJ   ÚxarrÚindss       r&   r­   r­   �  sˆ   € ð �=‰=€DÜ˜4Ÿ:™:Ô&à�y‰y˜‹ˆà�ÒØˆÜ”B—J‘J Ó%ˆð €Kô �z‰z˜$ÓˆàÐ(Ñ(Ø�z‰zœRŸZ™ZÒ'Ü×0Ñ0°Ó6�à€Kr(   c
                óü  — |	�|	}nt        |«      }| }|j                  «       sy|j                  «       ryt        t	        j
                  |«      «      }t        d|¬«      }|€d}t        t        |«      «      }t        d|¬«      }|€t        |«      }t        t        d|z   t        |«      «      «      }|dk(  r|t        t        ||d«      «      z  }n5|dk(  r|t        t        |d|«      «      z  }nt        t        |||«      «      }|d	k(  r	|||z  z  }n|d
k(  r||z
  |z
  }||z  }t        |«      }|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.
    Nrt   ©r}   r~   r   ru   rw   rƒ   r„   r‹   rŒ   r•   r²   )rJ   r¤   r¥   rk   FT)r   r9   ÚallÚsetr.   Úflatnonzeror�   Úranger!   Ú_interp_limitÚsortedr*   Úkindr´   rm   ÚargsortÚinterpÚ_interpolate_scipy_wrapperr
   r#   Únan)r¢   r£   rJ   r    r‡   rŽ   r¤   r¥   rk   r$   rp   Úinvalidrq   Úall_nansÚfirst_valid_indexÚ
start_nansÚlast_valid_indexÚend_nansÚpreserve_nansÚmid_nansÚis_datetimelikeÚindexers                         r&   r¦   r¦   ³  sK  € ð0 ÐØ‰ä�w“-ˆØˆH€Eà�9‰9Œ;Øà‡y�y„{Øô ”2—>‘> 'Ó*Ó+€Hä(¨W¸uÔEÐØÐ ØÐÜ”UÐ,Ó-Ó.€Jä'¨F¸UÔCÐØÐÜ˜w›<ÐÜ”5˜Ð-Ñ-¬s°5«zÓ:Ó;€Hð ˜)Ò#Ø"¤S¬°wÀÀqÓ)IÓ%JÑJ‰Ø	˜JÒ	&Ø ¤3¤}°W¸aÀÓ'GÓ#HÑH‰ô œM¨'°5¸%Ó@ÓAˆð �XÒà˜ hÑ.Ñ.‰Ø	�yÒ	 à˜jÑ(¨8Ñ3ˆØ˜Ñ!ˆô ˜=Ó)€Mà—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ˆØ"ˆˆ]Ñð
 ñ	 
Ü!$§¡ˆ�Ñð ô "$§¡ˆ�ÑØ
r(   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#                  «       }|
|   } || ||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)ra   rb   re   rf   ri   rh   rg   )rS   r]   r^   r_   r`   rd   rd   )rÂ   r¤   r¥   rc   z;order needs to be specified and greater than 0; got order: Úk)r   rÒ   rÕ   r.   rµ   Úbarycentric_interpolateÚkrogh_interpolateÚ_from_derivativesÚ_cubicspline_interpolateÚ_akima_interpolateÚpchip_interpolateÚinterp1dr   r"   ÚUnivariateSplineÚflagsÚ	writeabler+   )rA   ÚyÚnew_xrJ   r¤   r¥   rk   rp   rÓ   rÕ   Úalt_methodsÚinterp1d_methodsrÂ   ÚterpÚnew_ys                  r&   rÅ   rÅ   %  s}  € ð ˆhÐ4Ð5€EÜ˜w¨eÕ4Ý!ä�J‰J�uÓ€Eð #×:Ñ:Ø×.Ñ.Ü-Ü 1Ü/Ü#Ø×.Ñ.ñ€KòÐð Ð!Ñ!Ø�\Ò!Ø‰DàˆDØ×#Ñ#Øˆq�t¨
Àð $ó 
ˆñ �U“ˆð( €Lð' 
�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Ø˜6Ñ"ˆÙ�Q˜˜5Ñ+ FÑ+ˆØ€Lr(   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Ô   rz   rw   )ÚordersÚextrapolate)rÒ   rÕ   ÚBPolyre   Úreshape)	ÚxiÚyirA   rk   Úderré   rÕ   rJ   Úms	            r&   rÙ   rÙ   l  s?   € õR "ð ×Ñ×/Ñ/€FÙˆr�2—:‘:˜b !Ó$¨UÀÔL€AáˆQ‹4€Kr(   c                óJ   — ddl m} |j                  | ||¬«      } |||¬«      S )aQ  
    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; 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.
    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Ô   rx   )Únu)rÒ   rÕ   ÚAkima1DInterpolator)rì   rí   rA   rî   ry   rÕ   ÚPs          r&   rÛ   rÛ   ž  s+   € õT "à×'Ñ'¨¨B°TÐ'Ó:€AáˆQ�3Œ<Ðr(   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Ô   )ry   Úbc_typeré   )rÒ   rÕ   ÚCubicSpline)rì   rí   rA   ry   rõ   ré   rÕ   ró   s           r&   rÚ   rÚ   Ï  s3   € õZ "à×ÑØ
ˆB�T 7¸ð 	 ó 	€Añ ˆQ‹4€Kr(   c                ó4  — t        | «      }| }|j                  «       szt        d|¬«      }|€d}t        d|¬«      }|€t        | «      }t	        | |||¬«       |dk(  r	d|||d	z    n|d
k(  rdx|d| ||d	z   d nt        d«      ‚t        j                  | |<   yy)a«  
    Apply interpolation and limit_area logic to values along a to-be-specified axis.

    Parameters
    ----------
    values: np.ndarray
        Input array.
    method: str
        Interpolation method. Could be "bfill" or "pad"
    limit: int, optional
        Index limit on interpolation.
    limit_area: {'inside', 'outside'}
        Limit area for interpolation.

    Notes
    -----
    Modifies values in-place.
    rt   r»   Nr   ru   )rJ   r    rŽ   r‹   Frw   rŒ   z*limit_area should be 'inside' or 'outside')r   r¼   r�   r!   Úpad_or_backfill_inplacer"   r.   rÆ   )r\   rJ   r    rŽ   rÇ   r~   rt   ru   s           r&   Ú_interpolate_with_limit_arearù   %  s¼   € ô2 �6‹l€GØˆx€Hà�;‰;Œ=Ü  W°xÔ@ˆØˆ=ØˆEÜ F°XÔ>ˆØˆ<Ü�v“;ˆDäØØØØ!õ		
ð ˜Ò!Ø(-ˆG�E˜D 1™HÑ%Ø˜9Ò$Ø49Ð9ˆG�F�UˆO˜g d¨Q¡h jÑ1äÐIÓJÐJäŸ&™&ˆˆwŠð- r(   c                óü   — |dk(  rd„ nd„ }| j                   dk(  r7|dk7  rt        d«      ‚| j                  t        d| j                  z   «      «      } 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 rG   rH   ©rA   s    r&   ú<lambda>z)pad_or_backfill_inplace.<locals>.<lambda>v  s   € ˜€ r(   c                ó   — | j                   S rG   )ÚTrü   s    r&   rý   z)pad_or_backfill_inplace.<locals>.<lambda>v  s
   € ¸¿¹€ r(   rw   z0cannot interpolate on a ndim == 1 with axis != 0©rw   rv   )r{   )r    rŽ   N)r{   ÚAssertionErrorrë   Útupler4   rK   Úget_fill_func)r\   rJ   ry   r    rŽ   ÚtransfÚtvaluesr¨   s           r&   rø   rø   Z  sy   € ð8 # ašiŠk©m€Fð ‡{�{�aÒØ�1Š9Ü Ð!SÓTÐTØ—‘¤ d¨V¯\©\Ñ&9Ó :Ó;ˆä˜vÓ&€FÙ�V‹n€Gä˜ aÔ(€Dáˆ˜¨*Ö5r(   c                ó    — |€t        | «      }|S rG   )r   )r\   r$   s     r&   Ú_fillna_prepr  †  s   € ð
 €|Ü�F‹|ˆà€Kr(   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   r*   r   r´   )r\   r    rŽ   r$   Úresultr¨   s        €r&   Únew_funcz&_datetimelike_compat.<locals>.new_func–  sj   ø€ ô ˜vŸ|™|Ô,Øˆ|ä˜F“|�áØ—‘˜DÓ!¨¸:ÈDô‰LˆF�Dð —;‘;˜vŸ|™|Ó,¨dÐ2Ð2á�F %°JÀTÔJÐJr(   ©NNN)r    ú
int | NonerŽ   ú#Literal['inside', 'outside'] | None)r   r   r   )r¨   r  s   ` r&   Ú_datetimelike_compatr  ‘  sK   ø€ ô
 ˆ4ƒ[ð !Ø:>Øð	KàðKð 8ôKó ðKô$ ”�8ÓÐr(   c                óŽ   — t        | |«      }|�|j                  «       st        ||«       t        j                  | ||¬«       | |fS ©N)r    )r  r¼   Ú_fill_limit_area_1dr   Úpad_inplace©r\   r    rŽ   r$   s       r&   Ú_pad_1dr  ¬  sD   € ô ˜ Ó%€DØÐ d§h¡h¤jÜ˜D *Ô-Ü	×Ñ�f˜d¨%Õ0Ø�4ˆ<Ðr(   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ˆ<Ðr(   c                ó�   — t        | |«      }|�t        ||«       | j                  rt        j                  | ||¬«       | |fS 	 | |fS r  )r  Ú_fill_limit_area_2dÚsizer   Úpad_2d_inplacer  s       r&   Ú_pad_2dr  È  sT   € ô ˜ Ó%€DØÐÜ˜D *Ô-à‡{‚{Ü×Ñ˜V T°Õ7ð �4ˆ<Ðð 	Ø�4ˆ<Ðr(   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ˆ<Ðr(   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.
    Nrz   rw   r‹   FrŒ   )r|   r!   )r$   rŽ   Úneg_maskrt   ru   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˜Ñð 
!r(   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   rx   Nrz   F)rÿ   r.   Ú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ˆ�‰‚Or(   ©rP   rR   c                óT   — t        | «      } |dk(  r	t        |    S t        t        dœ|    S )Nrw   r'  )rK   Ú_fill_methodsr  r   )rJ   r{   s     r&   r  r  *  s.   € Ü˜vÓ&€FØˆq‚yÜ˜VÑ$Ð$Ü¬Ñ5°fÑ=Ð=r(   c                ó"   — | €y t        | d¬«      S )NTrD   )rK   )rJ   s    r&   Úclean_reindex_fill_methodr+  1  s   € Ø€~ØÜ˜V°4Ô8Ð8r(   c                óT  ‡— t        | «      Št        «       }t        «       }dˆfd„}|�0|dk(  r"t        t        j                  | «      d   «      }n	 || |«      }|�J|dk(  r|S t	         || ddd…   |«      «      }t        ‰dz
  t        j
                  |«      z
  «      }|dk(  r|S ||z  S )ak  
    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
    c           	     ó  •— t        |‰«      }t        | |dz   «      j                  d«      }t        t	        j
                  |«      d   |z   «      t        t	        j
                  | d |dz     j                  «       dk(  «      d   «      z  }|S )Nrw   r   )ÚminÚ_rolling_windowr¼   r½   r.   ÚwhereÚcumsum)rÇ   r    ÚwindowedÚidxÚNs       €r&   Úinnerz_interp_limit.<locals>.inner\  s†   ø€ Ü�E˜1“ˆÜ" 7¨E°A©IÓ6×:Ñ:¸1Ó=ˆÜ”"—(‘(˜8Ó$ QÑ'¨%Ñ/Ó0´3Ü�H‰H�w˜{ ¨¡Ð+Ð+×3Ñ3Ó5¸Ñ:Ó;¸AÑ>ó4
ñ 
ˆð ˆ
r(   Nr   rz   rw   )r    Úint)r!   r½   r.   r0  Úlistrµ   )rÇ   Úfw_limitÚbw_limitÚf_idxÚb_idxr5  Ú	b_idx_invr4  s          @r&   rÀ   rÀ   7  s´   ø€ ôB 	ˆG‹€AÜ‹E€EÜ‹E€Eõð ÐØ�qŠ=ÜœŸ™ Ó)¨!Ñ,Ó-‰Eá˜' 8Ó,ˆEàÐØ�qŠ=ð ˆLä™U 7©4¨R¨4¡=°(Ó;Ó<ˆIÜ˜˜A™¤§
¡
¨9Ó 5Ñ5Ó6ˆEØ˜1Š}Ø�à�5‰=Ðr(   c                óâ   — | j                   dd | j                   d   |z
  dz   |fz   }| j                  | j                  d   fz   }t        j                  j                  j                  | ||¬«      S )z™
    [True, True, False, True, False], 2 ->

    [
        [True,  True],
        [True, False],
        [False, True],
        [True, False],
    ]
    Nrz   rw   )r4   Ústrides)r4   r>  r.   r   Ústride_tricksÚ
as_strided)ÚaÚwindowr4   r>  s       r&   r/  r/  x  sj   € ð �G‰G�C�RˆL˜AŸG™G B™K¨&Ñ0°1Ñ4°fÐ=Ñ=€EØ�i‰i˜1Ÿ9™9 R™=Ð*Ñ*€GÜ�6‰6×Ñ×*Ñ*¨1°EÀ7Ð*ÓKÐKr(   )r$   únpt.NDArray[np.bool_]r%   r6  )r:   r   rª   rC  )rJ   z,Literal['ffill', 'pad', 'bfill', 'backfill']rE   zLiteral[False]rª   úLiteral['pad', 'backfill'])rJ   ú7Literal['ffill', 'pad', 'bfill', 'backfill', 'nearest']rE   zLiteral[True]rª   ú%Literal['pad', 'backfill', 'nearest'])rJ   rE  rE   r5   rª   rF  )rJ   rT   r[   r   rª   rT   )r}   rT   r~   rC  rª   r  )r‡   rT   rª   z&Literal['forward', 'backward', 'both'])rŽ   ú
str | Nonerª   r  )r‡   z-Literal['backward', 'forward', 'both'] | NonerJ   rT   rª   z&Literal['backward', 'forward', 'both'])r[   r   rª   r   )rY   Nrƒ   NNN)r¯   r©   r[   r   ry   r   rJ   rT   r    r  r‡   rT   rŽ   rG  r¤   ú
Any | Nonerª   r«   )r[   r   rJ   rT   rª   r©   )rY   Nrƒ   NNFNN)r¢   r©   r£   r©   rJ   rT   r    r  r‡   rT   rŽ   r  r¤   rH  r¥   r5   rk   r  rª   r«   )NFN)
rA   r©   rá   r©   râ   r©   rJ   rT   r¥   r5   )Nr   F)
rì   r©   rí   r©   rA   r©   rî   úint | list[int] | Noneré   r5   )r   r   )
rì   r©   rí   r©   rA   r©   rî   rI  ry   r   )r   z
not-a-knotN)
rì   r©   rí   r©   rA   r©   ry   r   rõ   zstr | tuple[Any, Any])
r\   r©   rJ   rD  r    r  rŽ   zLiteral['inside', 'outside']rª   r«   )rP   r   NN)r\   r©   rJ   rD  ry   r   r    r  rŽ   r  rª   r«   rG   )r$   únpt.NDArray[np.bool_] | Nonerª   rC  )r¨   r   rª   r   r  )
r\   r©   r    r  rŽ   r  r$   rJ  rª   z(tuple[np.ndarray, npt.NDArray[np.bool_]])r\   r©   r    r  rŽ   r  r$   rJ  )r    r  rŽ   r  r$   rJ  )r$   rC  rŽ   zLiteral['outside', 'inside']rª   r«   r   )r{   r6  )rª   zReindexMethod | None)rÇ   rC  r8  r  r9  r  )rA  rC  rB  r6  rª   rC  )KÚ__doc__Ú
__future__r   Ú	functoolsr   Útypingr   r   r   r   r	   Únumpyr.   Ú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   r   Úpandas.core.dtypes.dtypesr   Úpandas.core.dtypes.missingr   r   r   r–   r   r'   rC   rK   rm   rn   rr   r�   r‰   r�   r“   rœ   r°   r­   r¦   rÅ   rÙ   rÛ   rÚ   rù   rø   r  r  r  r  r  r   r  r  r)  r  r+  rÀ   r/  rH   r(   r&   ú<module>rW     s…  ðñõ #å ÷õ ó ÷ñ ÷
õ õ ?å 4÷÷ õ 6÷ñ ñ ÝóóFðR 
ð %(ñØ8ðð "ðð  ò	ó 
ðð 
ðØCðð !ðð +ò	ó 
ðð  ñØCðð ðð +ó	ò4 3€
ò€
ó$ó&#ðLØðà+óóðØBðØLOðà+óó*ðF ØØ$Ø!Ø!Ø	ðC*Ø
ðC*àðC*ð ðC*ð ð	C*ð
 ðC*ð ðC*ð ðC*ð ðC*ð 
óC*óLð2 ØØ$Ø6:Ø!ØØØ	ðoØðoàðoð ðoð ð	oð
 ðoð 4ðoð ðoð ðoð ðoð 
óoðn ØØ
ðDØðDàðDð ðDð ð	Dð óDðV Ø"#Øð/Øð/àð/ð ð/ð
 
 ð/ð ó/ðl #$Øð.Øð.àð.ð ð.ð 
 ð	.ð
 ó.ðj Ø%1ØðSØðSàðSð ðSð ð	Sð
 #óSðl2!Øð2!à&ð2!ð ð2!ð -ð	2!ð
 
ó2!ðn */ØØØ6:ð)6Øð)6à&ð)6ð ð)6ð ð	)6ð
 4ð)6ð 
ó)6ðZ 26ðØ.ðàóóð6 ð Ø6:Ø)-ð	
Øð
àð
ð 4ð
ð 'ð	
ð
 .ò
ó ð
ð ð Ø6:Ø)-ð	
Øð
àð
ð 4ð
ð 'ð	
ð
 .ò
ó ð
ð ð Ø6:Ø)-ð	Øðàðð 4ðð 'ò	ó ðð$ ð Ø6:Ø)-ð	àðð 4ðð 'ò	ó ðð$'Ø
ð'Ø-Ið'à	ó'ð4Ø
ðØ-Iðà	óð>  ¨\Ñ:€ô>ó9ð>Ø"ð>Ø.8ð>ØDNó>ôBLr(   