§
    Ï! 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) dzd„Z*d{d„Z+e
ddœd|d„¦   «         Z,e
d}d"„¦   «         Z,d#dœd~d%„Z,g d&¢Z-g d'¢Z.dd+„Z/d€d/„Z0d�d2„Z1d‚d6„Z2dƒd9„Z3d„d:„Z4	 	 	 	 	 	 d…d†dE„Z5d‡dF„Z6	 	 	 	 	 	 	 	 dˆd‰dK„Z7	 	 	 dŠd‹dO„Z8	 	 	 dŒd�dU„Z9	 	 dŽd�dV„Z:	 	 	 d�d‘dZ„Z;d’d]„Z<	 	 	 	 d“d”d_„Z=	 d•d–da„Z>d—dd„Z?e?	 	 	 d˜d™df„¦   «         Z@e?	 	 	 d˜d™dg„¦   «         ZAe?	 	 	 d˜dšdh„¦   «         ZBe?	 	 	 d˜d›di„¦   «         ZCdœdk„ZDdœdl„ZEe@eAdmœZFd�dždp„ZGdŸdr„ZHd dv„ZId¡dy„ZJdS )¢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©ÚIndexÚmaskúnpt.NDArray[np.bool_]ÚlengthÚintc                óž   — t          | ¦  «        r=t          | ¦  «        |k    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)Úvaluer    r"   s      úMc:\xampp_lite_8_4\www\timesheet\venv\Lib\site-packages\pandas/core/missing.pyÚcheck_value_sizer)   3   sk   € õ �UÑÔð Ýˆu‰:Œ:˜ÒÐÝð&½#¸e¹*¼*ð &ð &Ø#ð&ð &ñô ð ð �d”ˆà€Ló    Úarrr   Úreturnc                ó.  — t          |¦  «        \  }}t          |t          j        ¦  «        rt          j        ||¬¦  «        }nC|                     ¦   «         }t          j        |¦  «        s|g}|                     ||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Œ|r5t          j        | j        t          j        ¬¦  «        }
| |         |	k    |
|<   n<| |	k    }
t          |
t          j        ¦  «        s|
                     t          d¬¦  «        }
||
z  }ŒŒ|                     ¦   «         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)r+   Úvalues_to_maskr.   ÚclsÚpotential_naÚarr_maskÚna_maskÚnonnar    ÚxÚnew_masks              r(   Úmask_missingrF   B   s  € õ" -¨^Ñ<Ô<Ñ€Eˆ>å�%�œÑ"Ô"ð UÝœ .¸Ð>Ñ>Ô>ˆˆà×(Ò(Ñ*Ô*ˆÝÔ Ñ/Ô/ð 	.Ø,Ð-ˆNØ×+Ò+¨NÀ%ÈeÐ+ÑTÔTˆà€LÝ�s”yÑ!Ô!ð àˆÝ˜‘I”I�:ˆå�>Ñ"Ô"€GØ˜G˜8Ô$€Eõ Œ8�C”I¥TÐ*Ñ*Ô*€Då˜œÑ#Ô#ð!å˜cœiÑ(Ô(ð!õ ˜%œ+Ñ&Ô&ð!ð
 	å�c”iÑ Ô ð!å˜Uœ[Ñ)Ô)ð!õ ˜eœkÑ*Ô*ð!ð
 	àð 	!ð 	!ˆAÝ'¨¨QÑ/Ô/ð !ààð QÝ!œx¨¬	½¼ÐBÑBÔB�HØ),¨X¬¸!Ò);�H˜XÑ&Ð&à" ašx�Hå% hµ´
Ñ;Ô;ð Qà#+×#4Ò#4½4È%Ð#4Ñ#PÔ#P˜Ø˜Ñ ��à‡{‚{�}„}ð Ø•�S‘	”	Ñˆà€Kr*   .©Úallow_nearestÚmethodú,Literal['ffill', 'pad', 'bfill', 'backfill']rH   úLiteral[False]úLiteral['pad', 'backfill']c               ó   — d S ©N© ©rI   rH   s     r(   Úclean_fill_methodrQ   ‹   ó	   € ð €Cr*   ú7Literal['ffill', 'pad', 'bfill', 'backfill', 'nearest']úLiteral[True]ú%Literal['pad', 'backfill', 'nearest']c               ó   — d S rN   rO   rP   s     r(   rQ   rQ   ”   rR   r*   Fr9   c               óê   — t          | t          ¦  «        r%|                      ¦   «         } | dk    rd} n| dk    rd} ddg}d}|r|                     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 )r1   ÚstrÚlowerÚappendr&   )rI   rH   Úvalid_methodsÚ	expectings       r(   rQ   rQ   �   s¦   € õ
 �&�#ÑÔð  ð —’‘”ˆØ�WÒÐØˆFˆFØ�wÒÐØˆFà˜JÐ'€MØ1€IØð ?Ø×Ò˜YÑ'Ô'Ð'Ø>ˆ	Ø�]Ð"Ð"ÝÐT¸9ÐTÐTÈFÐTÐTÑUÔUÐUØ€Mr*   )ÚlinearÚtimeÚindexÚvalues)r\   ÚzeroÚslinearÚ	quadraticÚcubicÚbarycentricÚkroghÚsplineÚ
polynomialÚfrom_derivativesÚpiecewise_polynomialÚpchipÚakimaÚcubicspliner]   rd   r   c                óæ   — |                      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)rl   rm   z7You must specify the order of the spline or polynomial.zmethod must be one of z. Got 'z
' instead.)rk   ro   rp   z4 interpolation requires that the index be monotonic.)Úgetr&   Ú
NP_METHODSÚ
SP_METHODSÚis_monotonic_increasing)rI   rd   Úkwargsrt   Úvalids        r(   Úclean_interp_methodr{   Í   s¥   € Ø�JŠJ�wÑÔ€EàÐ)Ð)Ð)¨e¨mÝÐRÑSÔSÐSå�Ñ#€EØ�UÐÐÝÐR°%ÐRÐRÀÐRÐRÐRÑSÔSÐSàÐ;Ð;Ð;ØÔ,ð 	ÝØÐOÐOÐOñô ð ð €Mr*   ÚhowÚis_validú
int | Nonec                óH  — | dv sJ ‚t          |¦  «        dk    rdS |j        dk    r|                     d¬¦  «        }| dk    r|dd…                              ¦   «         }n6| dk    r0t          |¦  «        dz
  |ddd	…                              ¦   «         z
  }||         }|sdS |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%   Úndimr=   Úargmax)r|   r}   ÚidxposÚ	chk_notnas       r(   Úfind_valid_indexr‹   à   sÂ   € ð Ð#Ð#Ð#Ð#Ð#å
ˆ8�}„}˜ÒÐØˆtà„}˜ÒÐØ—<’< Q�<Ñ'Ô'ˆà
ˆg‚~€~Ø˜"˜"˜"”×$Ò$Ñ&Ô&ˆˆà	�ŠˆÝ�X‘” Ñ" X¨d¨d°¨d¤^×%:Ò%:Ñ%<Ô%<Ñ<ˆà˜Ô €Iàð Øˆtð €Mr*   Úlimit_directionú&Literal['forward', 'backward', 'both']c                ój   — g d¢}|                       ¦   «         } | |vrt          d|› d| › d�¦  «        ‚| S )N)ÚforwardÚbackwardÚbothz*Invalid limit_direction: expecting one of z, got 'z'.©r^   r&   )rŒ   Úvalid_limit_directionss     r(   Úvalidate_limit_directionr”     sq   € ð =Ð<Ð<ÐØ%×+Ò+Ñ-Ô-€OØÐ4Ð4Ð4ÝðBØ%ðBð BØ.=ðBð Bð Bñ
ô 
ð 	
ð Ðr*   Ú
limit_areaú
str | Noneú#Literal['inside', 'outside'] | Nonec                ón   — | �2ddg}|                       ¦   «         } | |vrt          d|› d| › d�¦  «        ‚| S )NÚinsideÚoutsidez%Invalid limit_area: expecting one of z, got ú.r’   )r•   Úvalid_limit_areass     r(   Úvalidate_limit_arear�     sn   € ØÐØ% yÐ1ÐØ×%Ò%Ñ'Ô'ˆ
ØÐ.Ð.Ð.Ýð!Ð8Ið !ð !Øð!ð !ð !ñô ð ð Ðr*   ú-Literal['backward', 'forward', 'both'] | Noneú&Literal['backward', 'forward', 'both']c                ó’   — | €
|dv rd} n=d} n:|dv r| dk    rt          d|› d�¦  «        ‚|dv r| dk    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Œ   rI   s     r(   Úinfer_limit_directionr¢   #  sš   € ð ÐØÐ*Ð*Ð*Ø(ˆOˆOà'ˆOˆOàÐ%Ð%Ð%¨/¸YÒ*FÐ*FÝØLÀ6ÐLÐLÐLñô ð ð Ð*Ð*Ð*¨À*Ò/LÐ/LÝØMÀFÐMÐMÐMñô ð ð Ðr*   c                óž  — | dk    r1ddl m}  |t          j        t	          |¦  «        ¦  «        ¦  «        }neh d£}t          |j        ¦  «        p3t          |j        t          ¦  «        pt          j
        |j        d¦  «        }| |vr|st          d| › d�¦  «        ‚t          |¦  «                             ¦   «         rt          d¦  «        ‚|S )	Nrb   r   r   >   rc   rd   re   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.zkInterpolation with NaNs in the index has not been implemented. Try filling those NaNs before interpolating.)Úpandasr   r2   Úaranger%   r   r.   r1   r   r   Úis_np_dtyper&   r   r=   ÚNotImplementedError)rI   rd   r   ÚmethodsÚis_numeric_or_datetimes        r(   Úget_interp_indexr«   8  sû   € à�ÒÐà Ð Ð Ð Ð Ð à�•b”i¥ E¡
¤
Ñ+Ô+Ñ,Ô,ˆˆà8Ð8Ð8ˆå˜Uœ[Ñ)Ô)ð 2Ý˜%œ+¥Ñ7Ô7ð2åŒ˜uœ{¨DÑ1Ô1ð 	ð
 ˜Ð Ð Ð)?Ð Ýð!Øð!ð !ð !ñô ð õ ˆE�{„{‡‚ÑÔð 
Ý!ð/ñ
ô 
ð 	
ð
 €Lr*   rb   r�   Údataú
np.ndarrayr…   r   ÚlimitÚ
fill_valueú
Any | NoneÚNonec	           	     ó¬  ‡‡‡‡‡‡	‡‡— 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        |
|| ¦  «         dS )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)Úcompatrc   zStime-weighted interpolation only works on Series or DataFrames with a DatetimeIndexre   N)Únobsr®   Úyvaluesr­   r,   r±   c                ó4   •— t          d‰| ‰‰‰‰‰d‰dœ	‰¤Ž d S )NF)	Úindicesrµ   rI   r®   rŒ   r•   r¯   Úbounds_errorr    rO   )Ú_interpolate_1d)	rµ   r¯   r·   ry   r®   Úlimit_area_validatedrŒ   r    rI   s	    €€€€€€€€r(   Úfuncz$interpolate_2d_inplace.<locals>.func„  sP   ø€ õ 	ð 	
ØØØØØ+Ø+Ø!ØØð	
ð 	
ð ð	
ð 	
ð 	
ð 	
ð 	
r*   )rµ   r­   r,   r±   )r{   r   r.   r   r   r&   r”   r�   r   Úvalidate_limitÚ_index_to_interp_indicesr2   Úapply_along_axis)r¬   rd   r…   rI   r®   rŒ   r•   r¯   r    ry   r»   r·   rº   s      ``` ``` @@r(   Úinterpolate_2d_inplacer¿   W  s'  øøøøøøøø€ õ. ˜ Ð0Ð0¨Ð0Ð0Ð0å˜Z¨¬Ñ4Ô4ð BÝ'¨¬
¸5ÐAÑAÔAˆ
à�ÒÐÝ" 5¤;Ñ/Ô/ð 	Ýð ñô ð ð
 ˆå.¨Ñ?Ô?€OÝ.¨zÑ:Ô:Ðõ Ô  d°%Ð8Ñ8Ô8€Eå& u¨fÑ5Ô5€Gð
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
õ, Ô˜˜d DÑ)Ô)Ð)Ð)Ð)r*   c                ó.  — | j         }t          |j        ¦  «        r|                     d¦  «        }|dk    r|}t	          t
          j        |¦  «        }nAt          j        |¦  «        }|dv r)|j        t
          j        k    rt          j
        |¦  «        }|S )zE
    Convert Index to ndarray of indices to pass to NumPy/SciPy.
    Úi8rb   )re   rd   )Ú_valuesr   r.   Úviewr   r2   r;   ÚasarrayÚobject_r   Úmaybe_convert_objects)rd   rI   ÚxarrÚindss       r(   r½   r½   �  sŽ   € ð Œ=€DÝ˜4œ:Ñ&Ô&ð à�yŠy˜‰Œˆà�ÒÐØˆÝ•B”J Ñ%Ô%ˆˆåŒz˜$ÑÔˆàÐ(Ð(Ð(ØŒz�RœZÒ'Ð'ÝÔ0°Ñ6Ô6�à€Kr*   r·   rµ   r¸   rt   c
                ó¾  — |	�|	}nt          |¦  «        }| }|                     ¦   «         sdS |                     ¦   «         rdS t          t	          j        |¦  «        ¦  «        }t          d|¬¦  «        }|€d}t          t          |¦  «        ¦  «        }t          d|¬¦  «        }|€t          |¦  «        }t          t          d|z   t          |¦  «        ¦  «        ¦  «        }|dk    r"|t          t          ||d¦  «        ¦  «        z  }nF|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|                     d¦  «        }|t          v rRt	          j        | |         ¦  «        }t	          j        | |         | |         |         ||         |         ¦  «        ||<   n)t#          | |         ||         | |         f||||dœ|
¤Ž||<   |	�d|	dd…<   d|	|<   n!|rt$          j        ||<   nt          j        ||<   dS )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š   r¤   rÁ   )rI   r¯   r¸   rt   FT)r   r=   ÚallÚsetr2   Úflatnonzeror‹   Úranger%   Ú_interp_limitÚsortedr.   ÚkindrÃ   rv   ÚargsortÚinterpÚ_interpolate_scipy_wrapperr
   r'   Únan)r·   rµ   rI   r®   rŒ   r•   r¯   r¸   rt   r    ry   Úinvalidrz   Úall_nansÚfirst_valid_indexÚ
start_nansÚlast_valid_indexÚend_nansÚpreserve_nansÚmid_nansÚis_datetimelikeÚindexers                         r(   r¹   r¹   ³  s¾  € ð0 ÐØˆˆå�w‘-”-ˆØˆH€Eà�9Š9‰;Œ;ð Øˆà‡y‚y�{„{ð Øˆõ •2”> 'Ñ*Ô*Ñ+Ô+€Hå(¨W¸uÐEÑEÔEÐØÐ ØÐÝ•UÐ,Ñ-Ô-Ñ.Ô.€Jå'¨F¸UÐCÑCÔCÐØÐÝ˜w™<œ<ÐÝ•5˜Ð-Ñ-­s°5©z¬zÑ:Ô:Ñ;Ô;€Hð ˜)Ò#Ð#Ø"¥S­°wÀÀqÑ)IÔ)IÑ%JÔ%JÑJˆˆØ	˜JÒ	&Ð	&Ø ¥3¥}°W¸aÀÑ'GÔ'GÑ#HÔ#HÑHˆˆõ �M¨'°5¸%Ñ@Ô@ÑAÔAˆð �XÒÐà˜ hÑ.Ñ.ˆˆØ	�yÒ	 Ð	 à˜jÑ(¨8Ñ3ˆØ˜Ñ!ˆõ ˜=Ñ)Ô)€Mà”mÔ(¨DÐ0€Oàð %Ø—,’,˜tÑ$Ô$ˆà•ÐÐõ ”*˜W Uœ^Ñ,Ô,ˆÝœ9Ø�GÔ˜g eœn¨WÔ5°w¸u´~ÀgÔ7Nñ
ô 
ˆ�ÑÐõ 6Ø�EŒNØ�EŒNØ�GÔð	
ð Ø!Ø%Øð	
ð 	
ð ð	
ð 	
ˆ�Ñð ÐØˆˆQˆQˆQ‰Ø"ˆˆ]ÑÐØ	ð (Ý!$¤ˆ�ÑÐå!#¤ˆ�ÑØ
€Fr*   rD   ÚyÚnew_xc                ó¬  — |› d�}t          d|¬¦  «         ddlm}	 t          j        |¦  «        }|	j        |	j        t          t          t          t          |	j
        dœ}
g d¢}||v r1|dk    r|}n|}|	                     | ||||¬	¦  «        } ||¦  «        }n½|d
k    rDt          |¦  «        s|dk    rt          d|› �¦  «        ‚ |	j        | |fd|i|¤Ž} ||¦  «        }ns| j        j        s|                      ¦   «         } |j        j        s|                     ¦   «         }|j        j        s|                     ¦   «         }|
|         } || ||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)rj   rk   rn   ro   rr   rq   rp   )r\   rf   rg   rh   ri   rm   rm   )rÑ   r¯   r¸   rl   z;order needs to be specified and greater than 0; got order: Úk)r   rã   ræ   r2   rÄ   Úbarycentric_interpolateÚkrogh_interpolateÚ_from_derivativesÚ_cubicspline_interpolateÚ_akima_interpolateÚpchip_interpolateÚinterp1dr   r&   ÚUnivariateSplineÚflagsÚ	writeabler/   )rD   rà   rá   rI   r¯   r¸   rt   ry   rä   ræ   Úalt_methodsÚinterp1d_methodsrÑ   ÚterpÚnew_ys                  r(   rÔ   rÔ   %  sÉ  € ð Ð5Ð5Ð5€EÝ˜w¨eÐ4Ñ4Ô4Ð4Ø!Ð!Ð!Ð!Ð!Ð!åŒJ�uÑÔ€Eð #Ô:ØÔ.Ý-Ý 1Ý/Ý#ØÔ.ðð €Kðð ð Ðð Ð!Ð!Ð!Ø�\Ò!Ð!ØˆDˆDàˆDØ×#Ò#Øˆq�t¨
Àð $ñ 
ô 
ˆð ��U‘”ˆˆØ	�8Ò	Ð	å�‰;Œ;ð 	˜5 Aš:˜:ÝØUÈeÐUÐUñô ð ð ,ˆ{Ô+¨A¨qÐDÐD°EÐD¸VÐDÐDˆØ��U‘”ˆˆð ŒwÔ ð 	Ø—’‘”ˆAØŒwÔ ð 	Ø—’‘”ˆAØŒ{Ô$ð 	!Ø—J’J‘L”LˆEØ˜6Ô"ˆØ��Q˜˜5Ð+Ð+ FÐ+Ð+ˆØ€Lr*   ÚxiÚyiÚderúint | list[int] | NoneÚextrapolatec                ó‚   — ddl m} |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ƒ   )Úordersrú   )rã   ræ   ÚBPolyrn   Úreshape)	rö   r÷   rD   rt   rø   rú   ræ   rI   Úms	            r(   rê   rê   l  sW   € ðR "Ð!Ð!Ð!Ð!Ð!ð ÔÔ/€FØˆˆr�2—:’:˜b !Ñ$Ô$¨UÀÐLÑLÔL€Aàˆ1ˆQ‰4Œ4€Kr*   c                óX   — ddl m} |                     | ||¬¦  «        } |||¬¦  «        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å   r„   )Únu)rã   ræ   ÚAkima1DInterpolator)rö   r÷   rD   rø   r…   ræ   ÚPs          r(   rì   rì   ž  sC   € ðT "Ð!Ð!Ð!Ð!Ð!à×'Ò'¨¨B°TÐ'Ñ:Ô:€Aàˆ1ˆQ�3ˆ<‰<Œ<Ðr*   ú
not-a-knotÚbc_typeústr | tuple[Any, Any]c                óX   — ddl m} |                     | ||||¬¦  «        } ||¦  «        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…   r  rú   )rã   ræ   ÚCubicSpline)rö   r÷   rD   r…   r  rú   ræ   r  s           r(   rë   rë   Ï  sK   € ðZ "Ð!Ð!Ð!Ð!Ð!à×ÒØ
ˆB�T 7¸ð 	 ñ 	ô 	€Að ˆ1ˆQ‰4Œ4€Kr*   re   úLiteral['inside', 'outside']c                óx  — t          | ¦  «        }| }|                     ¦   «         s“t          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        | |<   dS dS )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.
    r€   rÊ   Nr   r�   )rI   r®   r•   r™   Frƒ   rš   z*limit_area should be 'inside' or 'outside')r   rË   r‹   r%   Úpad_or_backfill_inplacer&   r2   rÕ   )re   rI   r®   r•   rÖ   r}   r€   r�   s           r(   Ú_interpolate_with_limit_arear  %  sÿ   € õ2 �6‰lŒl€GØˆx€Hà�;Š;‰=Œ=ð !Ý  W°xÐ@Ñ@Ô@ˆØˆ=ØˆEÝ F°XÐ>Ñ>Ô>ˆØˆ<Ý�v‘;”;ˆDåØØØØ!ð		
ñ 	
ô 	
ð 	
ð ˜Ò!Ð!Ø(-ˆG�E˜D 1™HÐ$Ñ%Ð%Ø˜9Ò$Ð$Ø49Ð9ˆG�F�U�F‰O˜g d¨Q¡h j jÑ1Ð1åÐIÑJÔJÐJåœ&ˆˆw‰ˆˆð-!ð !r*   rY   c                ó$  — |dk    rd„ nd„ }| j         dk    r?|dk    rt          d¦  «        ‚|                      t          d| j        z   ¦  «        ¦  «        } t          |¦  «        } || ¦  «        }t          |d¬¦  «        } ||||¬	¦  «         d
S )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 rN   rO   ©rD   s    r(   ú<lambda>z)pad_or_backfill_inplace.<locals>.<lambda>v  s   € ˜€ r*   c                ó   — | j         S rN   )ÚTr  s    r(   r  z)pad_or_backfill_inplace.<locals>.<lambda>v  s   € ¸¼€ r*   rƒ   z0cannot interpolate on a ndim == 1 with axis != 0©rƒ   r‚   )r‡   )r®   r•   N)r‡   ÚAssertionErrorrþ   Útupler8   rQ   Úget_fill_func)re   rI   r…   r®   r•   ÚtransfÚtvaluesr»   s           r(   r  r  Z  s©   € ð8 # aši˜iˆkˆkˆk¨m¨m€Fð „{�aÒÐØ�1Š9ˆ9Ý Ð!SÑTÔTÐTØ—’¥ d¨V¬\Ñ&9Ñ :Ô :Ñ;Ô;ˆå˜vÑ&Ô&€FØˆf�V‰nŒn€Gå˜ aÐ(Ñ(Ô(€Dà€Dˆ˜¨*Ð5Ñ5Ô5Ð5Ð5Ð5r*   únpt.NDArray[np.bool_] | Nonec                ó(   — |€t          | ¦  «        }|S rN   )r   )re   r    s     r(   Ú_fillna_prepr  †  s   € ð
 €|Ý�F‰|Œ|ˆà€Kr*   r»   r   c                ól   ‡ — t          ‰ ¦  «        	 	 	 ddˆ fd„¦   «         }t          t          |¦  «        S )	z>
    Wrapper to handle datetime64 and timedelta64 dtypes.
    Nr®   r~   r•   r—   c                óî   •— t          | j        ¦  «        rR|€t          | ¦  «        } ‰|                      d¦  «        |||¬¦  «        \  }}|                     | j        ¦  «        |fS  ‰| |||¬¦  «        S )NrÁ   )r®   r•   r    )r   r.   r   rÃ   )re   r®   r•   r    Úresultr»   s        €r(   Únew_funcz&_datetimelike_compat.<locals>.new_func–  sŠ   ø€ õ ˜vœ|Ñ,Ô,ð 	3Øˆ|å˜F‘|”|�à˜4Ø—’˜DÑ!Ô!¨¸:ÈDðñ ô ‰LˆF�Dð —;’;˜vœ|Ñ,Ô,¨dÐ2Ð2àˆt�F %°JÀTÐJÑJÔJÐJr*   ©NNN)r®   r~   r•   r—   )r   r   r   )r»   r  s   ` r(   Ú_datetimelike_compatr!  ‘  s\   ø€ õ
 ˆ4�[„[ð !Ø:>Øð	Kð Kð Kð Kð Kð Kñ „[ðKõ$ •�8ÑÔÐr*   ú(tuple[np.ndarray, npt.NDArray[np.bool_]]c                ó¤   — t          | |¦  «        }|�$|                     ¦   «         st          ||¦  «         t          j        | ||¬¦  «         | |fS ©N)r®   )r  rË   Ú_fill_limit_area_1dr   Úpad_inplace©re   r®   r•   r    s       r(   Ú_pad_1dr(  ¬  sX   € õ ˜ Ñ%Ô%€DØÐ d§h¢h¡j¤jÐÝ˜D *Ñ-Ô-Ð-Ý	Ô�f˜d¨%Ð0Ñ0Ô0Ð0Ø�4ˆ<Ðr*   c                ó¤   — t          | |¦  «        }|�$|                     ¦   «         st          ||¦  «         t          j        | ||¬¦  «         | |fS r$  )r  rË   r%  r   Úbackfill_inplacer'  s       r(   Ú_backfill_1dr+  º  sX   € õ ˜ Ñ%Ô%€DØÐ d§h¢h¡j¤jÐÝ˜D *Ñ-Ô-Ð-Ý	Ô˜6 4¨uÐ5Ñ5Ô5Ð5Ø�4ˆ<Ðr*   c                óŽ   — t          | |¦  «        }|�t          ||¦  «         | j        rt          j        | ||¬¦  «         n	 | |fS r$  )r  Ú_fill_limit_area_2dÚsizer   Úpad_2d_inplacer'  s       r(   Ú_pad_2dr0  È  s]   € õ ˜ Ñ%Ô%€DØÐÝ˜D *Ñ-Ô-Ð-à„{ð ÝÔ˜V T°Ð7Ñ7Ô7Ð7Ð7ð 	Ø�4ˆ<Ðr*   c                óŽ   — t          | |¦  «        }|�t          ||¦  «         | j        rt          j        | ||¬¦  «         n	 | |fS r$  )r  r-  r.  r   Úbackfill_2d_inplacer'  s       r(   Ú_backfill_2dr3  Û  s]   € õ ˜ Ñ%Ô%€DØÐÝ˜D *Ñ-Ô-Ð-à„{ð ÝÔ! &¨$°eÐ<Ñ<Ô<Ð<Ð<ð 	Ø�4ˆ<Ðr*   úLiteral['outside', 'inside']c                óê   — |  }|                      ¦   «         }t          |¦  «        |ddd…                               ¦   «         z
  dz
  }|dk    rd| d|…<   d| |dz   d…<   dS |dk    rd| |dz   |…<   dS dS )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 D b Dœ>×0Ò0Ñ2Ô2Ñ2°QÑ6€DØ�XÒÐØˆˆVˆeˆV‰Ø ˆˆT�A‰XˆZˆZÑÐÐØ	�yÒ	 Ð	 Ø!&ˆˆU�Q‰Y˜ÐÑÐÐð 
!Ð	 r*   c                ó�  — | j          }|dk    rVt          j                             |d¬¦  «        t          j                             |ddd…         d¬¦  «        ddd…         z  }nWt          j                             |d¬¦  «         t          j                             |ddd…         d¬¦  «        ddd…          z  }d| |j         <   dS )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  r2   ÚmaximumÚ
accumulate)r    r•   r6  Úla_masks       r(   r-  r-    sÕ   € ð ”ˆw€HØ�YÒÐõ ŒJ×!Ò! (°Ð!Ñ3Ô3ÝŒj×#Ò# H¨T¨T¨r¨T¤N¸Ð#Ñ;Ô;¸D¸D¸b¸DÔAñBð 	ˆõ ŒZ×"Ò" 8°!Ð"Ñ4Ô4Ð4ÝŒz×$Ò$ X¨d¨d°¨d¤^¸!Ð$Ñ<Ô<¸T¸T¸r¸TÔBÐBñCð 	ð €DˆŒ�O€O€Or*   ©rY   r[   rƒ   r‡   c                óp   — t          | ¦  «        } |dk    rt          |          S t          t          dœ|          S )Nrƒ   r;  )rQ   Ú_fill_methodsr0  r3  )rI   r‡   s     r(   r  r  *  s6   € Ý˜vÑ&Ô&€FØˆq‚y€yÝ˜VÔ$Ð$Ý­Ð5Ð5°fÔ=Ð=r*   úReindexMethod | Nonec                ó,   — | €d S t          | d¬¦  «        S )NTrG   )rQ   )rI   s    r(   Úclean_reindex_fill_methodr@  1  s   € Ø€~ØˆtÝ˜V°4Ð8Ñ8Ô8Ð8r*   rÖ   Úfw_limitÚbw_limitc                óž  ‡— t          | ¦  «        Št          ¦   «         }t          ¦   «         }dˆfd„}|�:|dk    r(t          t          j        | ¦  «        d         ¦  «        }n || |¦  «        }|�Y|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
    r®   r#   c           	     ó\  •— t          |‰¦  «        }t          | |dz   ¦  «                             d¦  «        }t          t	          j        |¦  «        d         |z   ¦  «        t          t	          j        | d |dz   …                               ¦   «         dk    ¦  «        d         ¦  «        z  }|S )Nrƒ   r   )ÚminÚ_rolling_windowrË   rÌ   r2   ÚwhereÚcumsum)rÖ   r®   ÚwindowedÚidxÚNs       €r(   Úinnerz_interp_limit.<locals>.inner\  s�   ø€ Ý�E˜1‘”ˆÝ" 7¨E°A©IÑ6Ô6×:Ò:¸1Ñ=Ô=ˆÝ•"”(˜8Ñ$Ô$ QÔ'¨%Ñ/Ñ0Ô0µ3ÝŒH�w˜{ ¨¡˜{Ô+Ð+×3Ò3Ñ5Ô5¸Ò:Ñ;Ô;¸AÔ>ñ4
ô 4
ñ 
ˆð ˆ
r*   Nr   r†   rƒ   )r®   r#   )r%   rÌ   r2   rG  ÚlistrÄ   )rÖ   rA  rB  Úf_idxÚb_idxrL  Ú	b_idx_invrK  s          @r(   rÏ   rÏ   7  sò   ø€ õB 	ˆG‰Œ€AÝ‰EŒE€EÝ‰EŒE€Eðð ð ð ð ð ð ÐØ�qŠ=ˆ=Ý�œ Ñ)Ô)¨!Ô,Ñ-Ô-ˆEˆEà�E˜' 8Ñ,Ô,ˆEàÐØ�qŠ=ˆ=ð ˆLå˜U˜U 7¨4¨4¨R¨4¤=°(Ñ;Ô;Ñ<Ô<ˆIÝ˜˜A™¥¤
¨9Ñ 5Ô 5Ñ5Ñ6Ô6ˆEØ˜1Š}ˆ}Ø�à�5‰=Ðr*   ÚaÚwindowc                óÆ   — | j         dd…         | j         d         |z
  dz   |fz   }| j        | j        d         fz   }t          j        j                             | ||¬¦  «        S )z™
    [True, True, False, True, False], 2 ->

    [
        [True,  True],
        [True, False],
        [False, True],
        [True, False],
    ]
    Nr†   rƒ   )r8   Ústrides)r8   rT  r2   r   Ústride_tricksÚ
as_strided)rQ  rR  r8   rT  s       r(   rF  rF  x  sb   € ð ŒG�C�R�CŒL˜AœG BœK¨&Ñ0°1Ñ4°fÐ=Ñ=€EØŒi˜1œ9 Rœ=Ð*Ñ*€GÝŒ6Ô×*Ò*¨1°EÀ7Ð*ÑKÔKÐKr*   )r    r!   r"   r#   )r+   r   r,   r!   )rI   rJ   rH   rK   r,   rL   )rI   rS   rH   rT   r,   rU   )rI   rS   rH   r9   r,   rU   )rI   r]   rd   r   r,   r]   )r|   r]   r}   r!   r,   r~   )rŒ   r]   r,   r�   )r•   r–   r,   r—   )rŒ   rž   rI   r]   r,   rŸ   )rd   r   r,   r   )rb   Nr�   NNN)r¬   r­   rd   r   r…   r   rI   r]   r®   r~   rŒ   r]   r•   r–   r¯   r°   r,   r±   )rd   r   rI   r]   r,   r­   )rb   Nr�   NNFNN)r·   r­   rµ   r­   rI   r]   r®   r~   rŒ   r]   r•   r—   r¯   r°   r¸   r9   rt   r~   r,   r±   )NFN)
rD   r­   rà   r­   rá   r­   rI   r]   r¸   r9   )Nr   F)
rö   r­   r÷   r­   rD   r­   rø   rù   rú   r9   )r   r   )
rö   r­   r÷   r­   rD   r­   rø   rù   r…   r   )r   r  N)
rö   r­   r÷   r­   rD   r­   r…   r   r  r  )
re   r­   rI   rL   r®   r~   r•   r	  r,   r±   )rY   r   NN)re   r­   rI   rL   r…   r   r®   r~   r•   r—   r,   r±   rN   )r    r  r,   r!   )r»   r   r,   r   r   )
re   r­   r®   r~   r•   r—   r    r  r,   r"  )re   r­   r®   r~   r•   r—   r    r  )r®   r~   r•   r—   r    r  )r    r!   r•   r4  r,   r±   r  )r‡   r#   )r,   r>  )rÖ   r!   rA  r~   rB  r~   )rQ  r!   rR  r#   r,   r!   )KÚ__doc__Ú
__future__r   Ú	functoolsr   Útypingr   r   r   r   r	   Únumpyr2   Ú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)   rF   rQ   rv   rw   r{   r‹   r”   r�   r¢   r«   r¿   r½   r¹   rÔ   rê   rì   rë   r  r  r  r!  r(  r+  r0  r3  r%  r-  r=  r  r@  rÏ   rF  rO   r*   r(   ú<module>rc     sû  ððð ð #Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð ð ð ð ð Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð
ð ð ð ð ð ð ð ð ð ð ð ð ð ð ?Ð >Ð >Ð >Ð >Ð >à 4Ð 4Ð 4Ð 4Ð 4Ð 4ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð 6Ð 5Ð 5Ð 5Ð 5Ð 5ðð ð ð ð ð ð ð ð ð ð ð ØÐÐÐÐÐðð ð ð ðFð Fð Fð FðR 
ð %(ðð ð ð ð ñ 
„ðð 
ðð ð ñ 
„ðð  ðð ð ð ð ð ð4 3Ð2Ð2€
ðð ð €
ð$ð ð ð ð&#ð #ð #ð #ðLð ð ð ðð ð ð ðð ð ð ð*ð ð ð ðF ØØ$Ø!Ø!Ø	ðC*ð C*ð C*ð C*ð C*ðLð ð ð ð2 ØØ$Ø6:Ø!ØØØ	ðoð oð oð oð oðn ØØ
ðDð Dð Dð Dð DðV Ø"#Øð/ð /ð /ð /ð /ðl #$Øð.ð .ð .ð .ð .ðj Ø%1ØðSð Sð Sð Sð Sðl2!ð 2!ð 2!ð 2!ðn */ØØØ6:ð)6ð )6ð )6ð )6ð )6ðZ 26ðð ð ð ð ðð ð ð ð6 ð Ø6:Ø)-ð	
ð 
ð 
ð 
ñ Ôð
ð ð Ø6:Ø)-ð	
ð 
ð 
ð 
ñ Ôð
ð ð Ø6:Ø)-ð	ð ð ð ñ Ôðð$ ð Ø6:Ø)-ð	ð ð ð ñ Ôðð$'ð 'ð 'ð 'ð4ð ð ð ð>  ¨\Ð:Ð:€ð>ð >ð >ð >ð >ð9ð 9ð 9ð 9ð>ð >ð >ð >ðBLð Lð Lð Lð Lð Lr*   