+
    Ŝi                    :  a  0 t $ R t^ RIHt ^ RIHt ^ RIHtHtH	t	H
t
Ht ^ RIt^ RIHt ^ RIHtHtHt ^ RIHtHtHtHtHt ^ RIHt ^ R	IHt ^ R
IHtH t H!t!H"t"H#t# ^ RI$H%t%H&t&H't' ^ RI(H)t)H*t*H+t+ ]'       d!   ^ RI,H-t- ^ RIH.t. ^ RI/H0t0 ]	RS,          t1R]2R&   R R lt3R R lt4]RR/R R ll4       t5]R R l4       t5RR/R R llt5. RTOt6. RUOt7R R  lt8R! R" lt9R# R$ lt:R% R& lt;R' R( lt<R) R* lt=RVR+ R, llt>R- R. lt?RWR/ R0 llt@RXR1 R2 lltARYR3 R4 lltBRZR5 R6 lltCR[R7 R8 lltDR\R: R; lltER]R< R= lltFR> R? ltG]GR^R@ RA ll4       tH]GR^RB RC ll4       tI]GR^RD RE ll4       tJ]GR^RF RG ll4       tKRH RI ltLRJ RK ltMR9]HRL]I/tNR_RM RN lltORO RP ltPRQ RR ltQR# )`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)Indexr    _CubicBCc                    V ^8  d   QhRRRR/# )   masknpt.NDArray[np.bool_]lengthint )formats   "\/Users/mibo/.openclaw/workspace/.venv-ak/lib/python3.14/site-packages/pandas/core/missing.py__annotate__r,   >   s      "7      c                    \        V 4      '       d3   \        V 4      V8w  d   \        R\        V 4       RV 24      hW,          p V # )zB
Validate the size of the values passed to ExtensionArray.fillna.
z'Length of 'value' does not match. Got (z)  expected )r   len
ValueError)valuer%   r'   s   &&&r+   check_value_sizer2   >   sQ     Uu:9#e* F#H&  Lr-   c                    V ^8  d   QhRRRR/# )r$   arrr   returnr&   r)   )r*   s   "r+   r,   r,   M   s     L Li L+@ Lr-   c                    \        V4      w  r!\        V P                  \        \        34      '       EdA   \
        P                  ! V4      '       Ed$   \        P                  ! V4      '       Ed   \        4       '       g   V P                  P                  R8X  d   \        V P                  \        4      '       d9   \        P                  ! V P                  4      V P                  4       ( ,          pV# ^ RIHp VP                  V P                   4      P#                  R4      P%                  4       pV# V P                  P                  R9   d)   \        P&                  ! V P(                  \*        R7      pV# \        V4      '       d   \        V 4      # \        P&                  ! V P(                  \*        R7      p\-        V P                  4      '       d;   \/        V P                  4      '       g    \
        P0                  ! V4      '       d    V# \/        V P                  4      '       d1   \-        V4      '       d    \
        P0                  ! V4      '       g    V# \-        V P                  4      '       d   \        V\2        4      '       d    V# \5        V P                  4      '       d   \        V 4      ( pW,          V8H  W5&   V# W8H  p\        V\        P6                  4      '       g   VP%                  \*        RR7      pTpV# )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]
fNFiudtype)r:   na_value)r   
isinstancer:   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)r4   r1   r:   r%   pcarr_masknew_masks   &&     r+   mask_missingrQ   M   s     $E*LE 	399
;<<LLHHUOO 99>>S #))_55xx		*chhj[8 -yy/99%@IIKYY^^t#88CIIT2DKE{{Cy 88CIIT*D##cii((KK 	, K) 	cii  %5e%<%<S[[QVEWEW 	" K! 
#))	$	$E3)?)? K 
	#	# I:%/ K <(BJJ//((te(DHKr-   allow_nearest.c               $    V ^8  d   QhRRRRRR/# )r$   methodz,Literal['ffill', 'pad', 'bfill', 'backfill']rR   zLiteral[False]r5   Literal['pad', 'backfill']r)   )r*   s   "r+   r,   r,      s(     % %8% "%  	%r-   c                   R # Nr)   rT   rR   s   &$r+   clean_fill_methodrY      s    
 "%r-   c               $    V ^8  d   QhRRRRRR/# )r$   rT   7Literal['ffill', 'pad', 'bfill', 'backfill', 'nearest']rR   zLiteral[True]r5   %Literal['pad', 'backfill', 'nearest']r)   )r*   s   "r+   r,   r,      s(     0 0C0 !0 +	0r-   c                   R # rW   r)   rX   s   &$r+   rY   rY      s    
 -0r-   Fc               $    V ^8  d   QhRRRRRR/# )r$   rT   r[   rR   rJ   r5   r\   r)   )r*   s   "r+   r,   r,      s(      C  +	r-   c                   \        V \        4      '       d$   V P                  4       p V R 8X  d   Rp M	V R8X  d   Rp RR.pRpV'       d   VP                  R4       RpW9  d   \	        RV RV  24      hV # )	ffillpadbfillbackfillzpad (ffill) or backfill (bfill)nearestz(pad (ffill), backfill (bfill) or nearestzInvalid fill method. Expecting z. Got )r<   rL   lowerappendr0   )rT   rR   valid_methods	expectings   &$  r+   rY   rY      s    
 &# WFwFJ'M1IY'>	":9+VF8TUUMr-   c               $    V ^8  d   QhRRRRRR/# )r$   rT   rL   indexr!   r5   r)   )r*   s   "r+   r,   r,      s!       E  r-   c                    VP                  R 4      pV R9   d   Vf   \        R4      h\        \        ,           pW9  d   \        RV RV  R24      hV R9   d!   VP                  '       g   \        V  R24      hV # )orderz7You must specify the order of the spline or polynomial.zmethod must be one of z. Got 'z
' instead.z4 interpolation requires that the index be monotonic.)spline
polynomial)kroghpiecewise_polynomialpchip)getr0   
NP_METHODS
SP_METHODSis_monotonic_increasing)rT   rj   kwargsrl   valids   &&,  r+   clean_interp_methodrx      s    JJwE))emRSS#E1%xzRSS;;,,,(NO  Mr-   c               $    V ^8  d   QhRRRRRR/# )r$   howrL   is_validr&   r5   
int | Noner)   )r*   s   "r+   r,   r,      s"     $ $# $)> $: $r-   c                V   V R9   g   Q h\        V4      ^ 8X  d   R# VP                  ^8X  d   VP                  ^R7      pV R8X  d   VR,          P                  4       pM8V R8X  d2   \        V4      ^,
          VRRR1,          P                  4       ,
          pVX,          pV'       g   R# V# )z
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lastNaxisNNN)r~   r   )r/   ndimanyargmax)rz   r{   idxpos	chk_notnas   &&  r+   find_valid_indexr      s     ####
8}}}<<Q<'
g~"$$&	X"Xdd^%:%:%<< I Mr-   c                    V ^8  d   QhRRRR/# )r$   limit_directionrL   r5   z&Literal['forward', 'backward', 'both']r)   )r*   s   "r+   r,   r,     s      +r-   c                ^    . ROpV P                  4       p W9  d   \        RV RV  R24      hV # )forwardz*Invalid limit_direction: expecting one of z, got 'z'.)r   backwardbothre   r0   )r   valid_limit_directionss   & r+   validate_limit_directionr     sK     =%++-O48%&go->bB
 	
 r-   c                    V ^8  d   QhRRRR/# )r$   
limit_area
str | Noner5   #Literal['inside', 'outside'] | Noner)   )r*   s   "r+   r,   r,   %  s      J 3V r-   c                f    V e-   RR.pV P                  4       p W9  d   \        RV RV  R24      hV # )Ninsideoutsidez%Invalid limit_area: expecting one of z, got .r   )r   valid_limit_areass   & r+   validate_limit_arear   %  sS    %y1%%'
.78I7J&,a!  r-   c               $    V ^8  d   QhRRRRRR/# )r$   r   z-Literal['backward', 'forward', 'both'] | NonerT   rL   r5   z&Literal['backward', 'forward', 'both']r)   )r*   s   "r+   r,   r,   3  s$      BLO+r-   c                    V f   VR9   d   Rp V # Rp  V # VR9   d   V R8w  d   \        RV R24      hVR9   d   V R8w  d   \        RV R24      hV # )Nr   r   z0`limit_direction` must be 'forward' for method ``z1`limit_direction` must be 'backward' for method `)rc   rb   )ra   r`   )r0   )r   rT   s   &&r+   infer_limit_directionr   3  s     **(O  (O  %%/Y*FB6(!L  ***/LCF81M  r-   c                    V ^8  d   QhRRRR/# )r$   rj   r!   r5   r)   )r*   s   "r+   r,   r,   H  s        E  e  r-   c                   V R 8X  d   ^ RI Hp V! \        V4      4      pM0 Rmp\        VP                  4      ;'       gD    \        VP                  \        4      ;'       g"    \        P                  ! VP                  R4      p\        \        ,           pW9   d   W9  d   V'       g   \        RV  R24      hM\        RV  R24      h\        V4      P                  4       '       d   \        R4      hV# )	linear)
RangeIndex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.>   timerj   valuesrd   )pandasr   r/   r   r:   r<   r   r   is_np_dtypers   rt   r0   r   r   NotImplementedError)rT   rj   r   methodsis_numeric_or_datetimerw   s   &&    r+   get_interp_indexr   H  s    %3u:&8U[[) 2 2%++72 2u{{D1 	
 Z'?$-C #H %%%  ?xqIJJE{!/
 	

 Lr-   c               <    V ^8  d   QhRRRRRRRRR	R
RRRRRRRR/	# )r$   data
np.ndarrayrj   r!   r   r   rT   rL   limitr|   r   r   r   
fill_value
Any | Noner5   Noner)   )r*   s   "r+   r,   r,   k  sb     =* =*
=*=* =* 	=*
 =* =* =* =* 
=*r-   c	           	       aaaaaa	aa \        SV3/ S	B  \        SV P                  4      '       d   \        V P                  RR7      oSR8X  d)   \	        VP                  4      '       g   \        R4      hRo\        S4      o\        V4      o\        P                  ! RSR7      o\        VS4      oR VVV	VVVVV3R	 llp
\        P                  ! WV 4       R# )
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)compatr   zStime-weighted interpolation only works on Series or DataFrames with a DatetimeIndexr   N)nobsr   c                    V ^8  d   QhRRRR/# )r$   yvaluesr   r5   r   r)   )r*   s   "r+   r,   ,interpolate_2d_inplace.<locals>.__annotate__  s     
 
j 
T 
r-   c                B   < \        RR SRV RSRSRSRSRSRRR	S/	SB  R
# )indicesr   rT   r   r   r   r   bounds_errorFr%   Nr)   )_interpolate_1d)	r   r   r   rv   r   limit_area_validatedr   r%   rT   s	   &r+   func$interpolate_2d_inplace.<locals>.func  sm     	 	
	
	
 	
 		

 ,	
 ,	
 "	
 	
 	
 	
r-   )rx   r   r:   r   r   r0   r   r   r   validate_limit_index_to_interp_indicesr>   apply_along_axis)r   rj   r   rT   r   r   r   r   r%   rv   r   r   r   s   &&&fff&ffl @@r+   interpolate_2d_inplacer   k  s    . 00Z44'

5A
"5;;//  
 .?O.z:   d%8E&uf5G
 
  D)r-   c               $    V ^8  d   QhRRRRRR/# )r$   rj   r!   rT   rL   r5   r   r)   )r*   s   "r+   r,   r,     s!      E 3 : r-   c                d   V P                   p\        VP                  4      '       d   VP                  R4      pVR8X  d   Tp\	        \
        P                  V4      pV# \
        P                  ! V4      pVR9   d6   VP                  \
        P                  8X  d   \        P                  ! V4      pV# )z=
Convert Index to ndarray of indices to pass to NumPy/SciPy.
i8r   )r   rj   )_valuesr   r:   viewr   r>   rM   asarrayobject_r   maybe_convert_objects)rj   rT   xarrindss   &&  r+   r   r     s     ==D4::&&yyBJJ% K zz$((zzRZZ'006Kr-   c               @    V ^8  d   QhRRRRRRRRRRR	R
RRRRRRRR/
# )r$   r   r   r   rT   rL   r   r|   r   r   r   r   r   r   rJ   rl   r5   r   r)   )r*   s   "r+   r,   r,     sx     m mmm m 	m
 m 4m m m m 
mr-   c
                   V	e   T	pM\        V4      pV( pVP                  4       '       g   R# VP                  4       '       d   R# \        P                  ! V4      p\        RVR7      pVf   ^ p\        P                  ! V4      p\        RVR7      pVf   \        V4      p\        P                  ! ^V,           \        V4      4      pVR8X  d#   \        P                  ! V\        W^ 4      4      pMJVR8X  d$   \        P                  ! V\        V^ V4      4      pM \        P                  ! \        WV4      4      pVR8X  d0   \        P                  ! VV4      p\        P                  ! VV4      pMOVR8X  dI   \        P                  ! WR	R
7      p\        P                  ! VVR	R
7      p\        P                  ! VV4      pVP                  P                  R9   pV'       d   VP                  R4      pV\        9   dX   \        P                   ! W,          4      p\        P"                  ! W,          W,          V,          W,          V,          4      W&   M*\%        W,          W,          W,          3RVRVRVRV/V
B W&   V	e   RV	R&   R	V	V&   R# V'       d   \&        P(                  VV&   R# \        P*                  VV&   R# )z
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~   )rz   r{   r   r   r   r   r   Tassume_uniquer   r   rT   r   r   rl   Fr   )r   r   allr>   flatnonzeror   aranger/   union1d_interp_limitunique	setdiff1dr:   r@   r   rs   argsortinterp_interpolate_scipy_wrapperr
   r1   nan)r   r   rT   r   r   r   r   r   rl   r%   rv   invalidrw   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-HE99;;yy{{ ~~g&H(WuE ,-J'FUCw<yy--s5z:H )#

:}WQ/OP	J	&

8]7Au-MN 		-"FG X

=*=

=(;	y	 <<DI<<($G

=(;mm((D0O,,t$ **W^,99gnW5w~g7N
 6NN	
 		

 "	
 &	
 	
 	
 Q"]
 	 
!$  "$
r-   c          
     ,    V ^8  d   QhRRRRRRRRRR/# )	r$   xr   ynew_xrT   rL   r   rJ   r)   )r*   s   "r+   r,   r,   1  sA     J JJJ J 	J Jr-   c                h   V R2p\        RVR7       ^ RIHp	 \        P                  ! V4      pRV	P
                  RV	P                  R\        R\        R	\        R
\        RV	P                  /p
. ROpW;9   d+   VR8X  d   TpMTpV	P                  WWVR7      pV! V4      pV# VR8X  dF   \        V4      '       g   V^ 8:  d   \        RV 24      hV	P                  ! W3RV/VB pV! V4      pV# V P                  P                   '       g   V P#                  4       p VP                  P                   '       g   VP#                  4       pVP                  P                   '       g   VP#                  4       pV
P%                  VR4      pVf   \        RV R24      hVP'                  RR4       V! WV3/ VB pV# )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)extrainterpolatebarycentricro   from_derivativesrp   cubicsplineakimarq   rn   )r@   r   r   rm   z;order needs to be specified and greater than 0; got order: kNr   r   downcast)rd   zeroslinear	quadraticcubicrn   )r   r   r   r>   r   barycentric_interpolatekrogh_interpolate_from_derivatives_cubicspline_interpolate_akima_interpolatepchip_interpolateinterp1dr   r0   UnivariateSplineflags	writeablecopyrr   pop)r   r   r   rT   r   r   rl   rv   r   r   alt_methodsinterp1d_methodsr@   terpnew_ys   &&&&&&&,       r+   r   r   1  s    h45Ewe4!JJuE 	{::..- 1/#..9K !\!DD##t $ 
 U2 L1 
8	;;5A:MeWU  ++ADEDVDU" L ww   Aww   A{{$$$JJLEvt,<?xqIJJ 	

:t$Q5+F+Lr-   c          
     ,    V ^8  d   QhRRRRRRRRRR/# )	r$   xir   yir   derzint | list[int] | NoneextrapolaterJ   r)   )r*   s   "r+   r,   r,   ~  s:     / /// /
 
 / /r-   c                ~    ^ RI Hp VP                  P                  pV! WP	                  R^4      W5R7      pV! V4      # )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   )ordersr  r   )r   r   BPolyr   reshape)	r  r  r   rl   r  r  r   rT   ms	   &&&&&&   r+   r   r   ~  s;    R " //Fr::b!$ULAQ4Kr-   c          
     ,    V ^8  d   QhRRRRRRRRRR/# )	r$   r  r   r  r   r  r(   r   r   r)   )r*   s   "r+   r,   r,     s:     , ,,, , 
	,
 ,r-   c                F    ^ RI Hp VP                  WVR7      pV! W#R7      # )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. 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   )nu)r   r   Akima1DInterpolator)r  r  r   r  r   r   Ps   &&&&&  r+   r  r    s'    P "''T':AQ<r-   c               4    V ^8  d   QhRRRRRRRRRRR	R
RR/# )r$   r  r   r  r   r   r   bc_typez_CubicBC | tuple[Any, Any]r  z!Literal['periodic'] | bool | Noner5   r)   )r*   s   "r+   r,   r,     sW     S SSS S 	S
 (S 3S Sr-   c                F    ^ RI Hp VP                  WW4VR7      pV! V4      # )ak  
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  r  )r   r   CubicSpline)r  r  r   r   r  r  r   r  s   &&&&&&  r+   r   r     s/    Z "
T 	  	A Q4Kr-   ra   c               0    V ^8  d   QhRRRRRRRRR	R
RR/# )r$   r   r   rT   rU   r   r   r   r|   r   r   r5   r   r)   )r*   s   "r+   r,   r,   5  sD     )6 )6)6&)6 )6 	)6
 4)6 
)6r-   c                    V^ 8X  d   R MR pV P                   ^8X  d2   V^ 8w  d   \        R4      hV P                  ^.V P                  O54      p \	        V4      pV! V 4      p\        V^R7      pV! WcVR7       R# )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.
c                    V # rW   r)   r   s   &r+   <lambda>)pad_or_backfill_inplace.<locals>.<lambda>Q  s    r-   c                    V P                   # rW   )Tr#  s   &r+   r$  r%  Q  s    r-   z1cannot interpolate on an ndim == 1 with axis != 0)r   )r   r   N)r   AssertionErrorr  rI   rY   get_fill_func)r   rT   r   r   r   transftvaluesr   s   &&&&&   r+   pad_or_backfill_inplacer,  5  su    8 #aikmF {{a19 !TUU 2V\\ 23v&FVnGa(D*5r-   c                    V ^8  d   QhRRRR/# )r$   r%   npt.NDArray[np.bool_] | Noner5   r&   r)   )r*   s   "r+   r,   r,   a  s      .r-   c                $    Vf   \        V 4      pV# rW   )r   )r   r%   s   &&r+   _fillna_prepr0  a  s    
 |F|Kr-   c                    V ^8  d   QhRRRR/# )r$   r   r   r5   r)   )r*   s   "r+   r,   r,   l  s      q Q r-   c                V   a  \        S 4      RR V 3R lll4       p\        \        V4      # )z6
Wrapper to handle datetime64 and timedelta64 dtypes.
c                    V ^8  d   QhRRRR/# )r$   r   r|   r   r   r)   )r*   s   "r+   r,   *_datetimelike_compat.<locals>.__annotate__r  s"     K KK 8Kr-   c                   < \        V P                  4      '       dI   Vf   \        V 4      pS! V P                  R4      WVR7      w  rCVP                  V P                  4      V3# S! WW#R7      # )Nr   )r   r   r%   )r   r:   r   r   )r   r   r   r%   resultr   s   &&&& r+   new_func&_datetimelike_compat.<locals>.new_funcq  se     v||,,|F|D!DLF ;;v||,d22FJJJr-   NNN)r   r   r   )r   r7  s   f r+   _datetimelike_compatr:  l  s2    
 4[K K K$ 8r-   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# r$   r   r   r   r|   r   r   r%   r.  r5   z(tuple[np.ndarray, npt.NDArray[np.bool_]]r)   )r*   s   "r+   r,   r,     :     
 


 4
 '	

 .
r-   c                    \        W4      pVe"   VP                  4       '       g   \        W24       \        P                  ! WVR7       W3# N)r   )r0  r   _fill_limit_area_1dr   pad_inplacer   r   r   r%   s   &&&&r+   _pad_1drC    s>     %DdhhjjD-	f%0<r-   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# r<  r)   )r*   s   "r+   r,   r,     r=  r-   c                    \        W4      pVe"   VP                  4       '       g   \        W24       \        P                  ! WVR7       W3# r?  )r0  r   r@  r   backfill_inplacerB  s   &&&&r+   _backfill_1drG    s>     %DdhhjjD-	6u5<r-   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# r<  r)   )r*   s   "r+   r,   r,     s:       4 '	
 .r-   c                    \        W4      pVe   \        W24       V P                  '       d   \        P                  ! WVR7       W3# r?  )r0  _fill_limit_area_2dsizer   pad_2d_inplacerB  s   &&&&r+   _pad_2drM    s=     %DD-{{{V7<r-   c               $    V ^8  d   QhRRRRRR/# )r$   r   r|   r   r   r%   r.  r)   )r*   s   "r+   r,   r,     s(       4 '	r-   c                    \        W4      pVe   \        W24       V P                  '       d   \        P                  ! WVR7       W3#  W3# r?  )r0  rJ  rK  r   backfill_2d_inplacerB  s   &&&&r+   _backfill_2drQ    sL     %DD-{{{!!&e< < 	<r-   c               $    V ^8  d   QhRRRRRR/# r$   r%   r&   r   zLiteral['outside', 'inside']r5   r   r)   )r*   s   "r+   r,   r,     s$     ' '
'-I'	'r-   c                    V ( pVP                  4       p\        V4      VRRR1,          P                  4       ,
          ^,
          pVR8X  d   RV RV% RW^,           R% R# VR8X  d   RW^,           V% R# R# )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   Fr   r   )r   r/   )r%   r   neg_maskr~   r   s   &&   r+   r@  r@    sw      uHOOEx=8DbD>0022Q6DXVe AXZ	y	 !&QY 
!r-   c               $    V ^8  d   QhRRRRRR/# rS  r)   )r*   s   "r+   r,   r,     s$      
-I	r-   c                   V P                   ( pVR8X  d]   \        P                  P                  V^ R7      \        P                  P                  VRRR1,          ^ R7      RRR1,          ,          pM]\        P                  P                  V^ R7      ( \        P                  P                  VRRR1,          ^ R7      RRR1,          ( ,          pRWP                   &   R# )ag  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   NFr   )r'  r>   maximum
accumulate)r%   r   rU  la_masks   &&  r+   rJ  rJ    s     wHY JJ!!(!3jj##HTrTN#;DbDAB 	 ZZ""8!"44zz$$Xdd^!$<TrTBBC 	 DOr-   rc   c                   V ^8  d   QhRR/# )r$   r   r(   r)   )r*   s   "r+   r,   r,     s     > > >r-   c                j    \        V 4      p V^8X  d   \        V ,          # R\        R\        /V ,          # )   ra   rc   )rY   _fill_methodsrM  rQ  )rT   r   s   &&r+   r)  r)    s2    v&FqyV$$7J5f==r-   c                   V ^8  d   QhRR/# )r$   r5   zReindexMethod | Noner)   )r*   s   "r+   r,   r,   	  s     9 9)= 9r-   c                (    V f   R # \        V RR7      # )NT)rR   )rY   )rT   s   &r+   clean_reindex_fill_methodra  	  s    ~V488r-   c               (    V ^8  d   QhRRRRRRRR/# )r$   r   r&   fw_limitr|   bw_limitr5   r   r)   )r*   s   "r+   r,   r,     s8     @E @E"@E.8@EDN@E@Er-   c                  a \        V 4      o\        P                  ! . \        P                  R7      p\        P                  ! . \        P                  R7      pRpR V3R llpVe0   V^ 8X  d!   \        P                  ! V 4      ^ ,          pRpMV! W4      pVe4   V^ 8X  d   V# S^,
          V! V RRR1,          V4      ,
          pV^ 8X  d   V# \        P
                  ! W4VR7      # )	a  
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
r9   Tc                   V ^8  d   QhRR/# )r$   r   r(   r)   )r*   s   "r+   r,   #_interp_limit.<locals>.__annotate__5  s      c r-   c           	     ~  < \        VS4      p\        P                  P                  P	                  W^,           4      P                  ^4      p\        P                  ! \        P                  ! V4      ^ ,          V,           \        P                  ! V RV^,            ( P                  4       ^ 8H  4      ^ ,          4      pV# )r]  N)	minr>   r   stride_trickssliding_window_viewr   r   wherecumsum)r   r   windowedidxNs   &&  r+   inner_interp_limit.<locals>.inner5  s    E166'';;GQYOSSTUVjjHHXq!E)HHw{++335:;A>
 
r-   NFr   r   )r/   r>   arrayint64rl  intersect1d)r   rc  rd  f_idxb_idxr   rq  rp  s   &&&    @r+   r   r     s    B 	GAHHRrxx(EHHRrxx(EM  q=HHW%a(E!M',Eq= LEE'$B$-::E1}>>%mDDr-   )
not-a-knotclampednaturalperiodic)r   r   rj   r   )rd   r   r   r   r   r   ro   rm   rn   r   rp   rq   r   r   )r   Nr   NNN)r   Nr   NNFNN)NFN)N    F)r|  r|  )r|  rx  N)ra   r|  NNrW   r9  )r]  )R__conditional_annotations____doc__
__future__r   	functoolsr   typingr   r   r   r   r   numpyr>   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__r2   rQ   rY   rs   rt   rx   r   r   r   r   r   r   r   r   r   r   r  r   r,  r0  r:  rC  rG  rM  rQ  r@  rJ  r^  r)  ra  r   )r}  s   @r+   <module>r     s   #    $ 
  ? 4  
  ( !"PQHiQL^ 
% %(% 
% 
0 
0  4 3

$&$N* F=*@,m`JZ/d,^Sl)6X6 
 
 
 
    $'4> \:>9@Er-   