Ë
    u™ãjïÔ ã                  ó>  — d Z ddlmZ ddlZddlmZ ddlmZ ddlZddl	m
Z
mZmZ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c mc mZ ddl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. ddl/m0Z0 ddl1m2Z2 ddl3m4Z4 ddl5m6Z6m7Z7 ddl8m9Z9 ddl:m;Z; ddl<m=c m>Z? ddl@mAZAmBZBmCZCmDZD ddlEmFZFmGZGmHZHmIZImJZJ ddlKmLZL ddlMmNZNmOZOmPZP ddlQmRZRmSZS ddlTmUZUmVZVmWZW e
r8ddlXmYZY ddlXmZZZm[Z[m\Z\ ddl]m^Z^m_Z_m`Z`maZambZbmcZcmdZdmeZe ddlfmgZgmhZh ddlimjZj ddlkmlZl dd lmmnZn  G d!„ d"e;d#   «      Zo G d$„ d%eo«      Zp e"d&«       G d'„ d(eo«      «       Zq G d)„ d*eo«      Zr e"d&«       G d+„ d,er«      «       Zseqj                   es_          e"d&«       G d-„ d.epes«      «       Zty)/zc
Provide a generic structure to support window functions,
similar to how we have a Groupby object.
é    )ÚannotationsN)Ú	timedelta)Úpartial)ÚTYPE_CHECKINGÚAnyÚConcatenateÚLiteralÚSelfÚcastÚfinalÚoverload)Ú
BaseOffsetÚ	TimedeltaÚ	to_offset)Úimport_optional_dependency)Ú	DataError)Ú
set_module)Úensure_float64Úis_arrow_temporal_dtypeÚis_boolÚ
is_integerÚis_numeric_dtypeÚneeds_i8_conversion)Ú
ArrowDtype)ÚABCDataFrameÚ	ABCSeries)Únotna)Úexecutor)Ú	factorize)ÚResamplerWindowApplyÚreconstruct_func)ÚExtensionArray)ÚSelectionMixin)ÚBaseIndexerÚFixedWindowIndexerÚGroupByIndexerÚVariableWindowIndexer)ÚDatetimeIndexÚIndexÚ
MultiIndexÚPeriodIndexÚTimedeltaIndex)Úconcat)Úget_jit_argumentsÚmaybe_use_numbaÚprepare_function_arguments)Úflex_binary_momentÚzsqrt)Ú'generate_manual_numpy_nan_agg_with_axisÚgenerate_numba_apply_funcÚgenerate_numba_table_func)ÚCallable)ÚHashableÚIteratorÚSized)Ú	ArrayLikeÚNDFrameTÚQuantileInterpolationÚPÚTimeUnitÚTÚWindowingRankTypeÚnpt)Ú	DataFrameÚSeries)ÚNDFrame©ÚBaseGrouper)Údtype_to_unitc                  óÆ  — e Zd ZU dZg Zded<    e«       Zded<   ded<   	 	 	 	 	 	 	 	 d"dd	œ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d#d
„Zd$d„Z		 	 	 	 	 	 	 	 d%d„Z
d&d'd„Zd(d„Zd)d„Zd*d+d„Zd&d„Zd,d„Zd„ Zd-d„Zd.d„Zd/d„Zd0d„Zed1d„«       Zd2d„Zd3d„Z	 d&	 	 	 	 	 d4d„Z	 d*	 	 	 	 	 	 	 d5d„Z	 	 d6	 	 	 	 	 	 	 d7d„Z	 	 	 	 	 	 	 	 	 	 	 	 d8d„Z	 	 d9	 	 	 	 	 	 	 d:d„Z	 d&	 	 	 d;d „Zd&d!„Z e Z!y)<Ú
BaseWindowz7Provides utilities for performing windowing operations.ú	list[str]Ú_attributeszfrozenset[Hashable]Ú
exclusionsr)   Ú_onN)Ú	selectionc
               ó`  — || _         || _        || _        || _        || _        || _        || _        || _        |	| _        d | _	        | j                  €| j                   j                  | _        n©t        | j                  t        «      r| j                  | _        n}t        | j                   t        «      rJ| j                  | j                   j                  v r(t        | j                   | j                     «      | _        nt!        d| j                  › d�«      ‚|
| _        | j%                  «        y )Nzinvalid on specified as z3, must be a column (of DataFrame), an Index or None)ÚobjÚonÚclosedÚstepÚwindowÚmin_periodsÚcenterÚwin_typeÚmethodÚ_win_freq_i8ÚindexrM   Ú
isinstancer)   r   ÚcolumnsÚ
ValueErrorÚ
_selectionÚ	_validate)ÚselfrP   rT   rU   rV   rW   rQ   rR   rS   rX   rN   s              úe/var/www/html/python-recuperauto-other/env/lib/python3.12/site-packages/pandas/core/window/rolling.pyÚ__init__zBaseWindow.__init__|   sð   € ð ˆŒØˆŒØˆŒØˆŒ	ØˆŒØ&ˆÔØˆŒØ ˆŒØˆŒØ(,ˆÔØ�7‰7ˆ?Ø—x‘x—~‘~ˆD�HÜ˜Ÿ™¤Ô'Ø—w‘wˆD�HÜ˜Ÿ™¤,Ô/°D·G±G¸t¿x¹x×?OÑ?OÑ4OÜ˜TŸX™X d§g¡gÑ.Ó/ˆD�HäØ*¨4¯7©7¨)ð 4Dð Dóð ð
 $ˆŒØ�‰Õó    c                óš  — | j                   � t        | j                   «      st        d«      ‚| j                  ��t	        | j                  «      st        d«      ‚| j                  dk  rt        d«      ‚t	        | j
                  «      r>| j                  | j
                  kD  r%t        d| j                  › d| j
                  › �«      ‚| j                  �| j                  dvrt        d«      ‚t        | j                  t        t        f«      st        d	t        | «      › �«      ‚t        | j
                  t        «      r°t        j                  | j
                  j                   «      j"                  j%                  «       }t        j                  t        «       j                   «      j"                  j%                  «       }||k7  r+t        t        | j
                  «      j&                  › d
�«      ‚| j(                  dvrt        d«      ‚| j*                  �;t	        | j*                  «      st        d«      ‚| j*                  dk  rt        d«      ‚y y )Nzcenter must be a booleanzmin_periods must be an integerr   zmin_periods must be >= 0zmin_periods z must be <= window )ÚrightÚbothÚleftÚneitherz3closed must be 'right', 'left', 'both' or 'neither'zinvalid type: z? does not implement the correct signature for get_window_bounds)ÚtableÚsinglez!method must be 'table' or 'singlezstep must be an integerzstep must be >= 0)rV   r   r]   rU   r   rT   rR   r[   rP   r   r   Ú	TypeErrorÚtyper$   ÚinspectÚ	signatureÚget_window_boundsÚ
parametersÚkeysÚ__name__rX   rS   )r`   Úget_window_bounds_signatureÚexpected_signatures      ra   r_   zBaseWindow._validate£   sù  € Ø�;‰;Ð"¬7°4·;±;Ô+?ÜÐ7Ó8Ð8Ø×ÑÐ'Ü˜d×.Ñ.Ô/Ü Ð!AÓBÐBØ×Ñ !Ò#Ü Ð!;Ó<Ð<Ü˜$Ÿ+™+Ô&¨4×+;Ñ+;¸d¿k¹kÒ+IÜ Ø" 4×#3Ñ#3Ð"4Ð4GÈÏÉÀ}ÐUóð ð �;‰;Ð" t§{¡{ð ;
ñ (
ô ÐRÓSÐSÜ˜$Ÿ(™(¤Y´Ð$=Ô>Ü˜n¬T°$«Z¨LÐ9Ó:Ð:Ü�d—k‘k¤;Ô/ô +2×*;Ñ*;Ø—‘×-Ñ-ó+ç‰jŸ™›ð (ô ")×!2Ñ!2Ü“×/Ñ/ó"ç‰jŸ™›ð ð +Ð.@Ò@Ü Ü˜DŸK™KÓ(×1Ñ1Ð2ð 3Bð Cóð ð �;‰;Ð1Ñ1ÜÐ@ÓAÐAØ�9‰9Ð Ü˜dŸi™iÔ(Ü Ð!:Ó;Ð;Ø�y‰y˜1Š}Ü Ð!4Ó5Ð5ð ð !rc   c           	     ó0  — t        |«      t        |«      k7  r$t        dt        |«      › dt        |«      › d�«      ‚t        |«      || j                  xs dz   dz
  | j                  xs dz  k7  r(t        dt        |«      › d|› d| j                  › d�«      ‚y )	Nzstart (z) and end (z ) bounds must be the same lengthé   zstart and end bounds (z)) must be the same length as the object (z) divided by the step (z) if given and rounded up)Úlenr]   rS   )r`   ÚstartÚendÚnum_valss       ra   Ú_check_window_boundszBaseWindow._check_window_boundsÎ   s«   € ô ˆu‹:œ˜S›Ò!ÜØœ#˜e›*˜ [´°S³°
ð ;ð óð ô ˆu‹:˜( d§i¡i¢n°1Ñ5¸Ñ9¸t¿y¹yº~ÈAÑNÒNÜØ(¬¨U«¨ð 5"Ø"* Ð+BÀ4Ç9Á9À+ð N*ð+óð ð Orc   c                ó\   — |�t        |«      t        |«      k(  r|S |dd| j                  …   S )zJ
        Slices the index for a given result and the preset step.
        N)rw   rS   )r`   rZ   Úresults      ra   Ú_slice_axis_for_stepzBaseWindow._slice_axis_for_stepÝ   s9   € ð ˆ~¤ V£´°E³
Ò!:ð ð	
ð ‘|˜$Ÿ)™)�|Ñ$ð	
rc   c                óÄ   — | j                   j                  dk(  rG|rDt        | j                   j                  «      s$t	        t        | «      j                  › d|› d�«      ‚yyy)zö
        Validate numeric_only argument, raising if invalid for the input.

        Parameters
        ----------
        name : str
            Name of the operator (kernel).
        numeric_only : bool
            Value passed by user.
        rv   ú.z  does not implement numeric_onlyN)Ú_selected_objÚndimr   ÚdtypeÚNotImplementedErrorrl   rr   )r`   ÚnameÚnumeric_onlys      ra   Ú_validate_numeric_onlyz!BaseWindow._validate_numeric_onlyç   sg   € ð ×Ñ×#Ñ# qÒ(ÙÜ$ T×%7Ñ%7×%=Ñ%=Ô>ä%Ü˜“:×&Ñ&Ð' q¨¨Ð.NÐOóð ð ?ð ð )rc   c                ó0   — |j                  dgdg¬«      }|S )z¹Subset DataFrame to numeric columns.

        Parameters
        ----------
        obj : DataFrame

        Returns
        -------
        obj subset to numeric-only columns.
        Únumberr   )ÚincludeÚexclude)Úselect_dtypes)r`   rP   r}   s      ra   Ú_make_numeric_onlyzBaseWindow._make_numeric_onlyû   s"   € ð ×"Ñ"¨H¨:À¸}Ð"ÓMˆØˆrc   c                ó$  — | j                   �at        | j                   t        «      sG|j                  dk(  r8|j	                  |j
                  j                  | j                   gd¬«      ¬«      }|j                  dkD  r|r| j                  |«      }|S )úA
        Split data into blocks & return conformed data.
        é   F)Úsort)r\   rv   )rQ   r[   r)   r‚   Úreindexr\   Ú
differencer�   )r`   rP   r†   s      ra   Ú_create_datazBaseWindow._create_data	  sr   € ð
 �7‰7Ð¤z°$·'±'¼5Ô'AÀcÇhÁhÐRSÂmØ—+‘+ c§k¡k×&<Ñ&<¸d¿g¹g¸YÈUÐ&<Ó&S�+ÓTˆCØ�8‰8�aŠ<™LØ×)Ñ)¨#Ó.ˆCØˆ
rc   c                óÀ   — |€| j                   }| j                  D �ci c]  }|t        | |«      “Œ }}| j                  ||«      } t	        | «      |fd|i|¤Ž}|S c c}w )a  
        Sub-classes to define. Return a sliced object.

        Parameters
        ----------
        key : str / list of selections
        ndim : {1, 2}
            requested ndim of result
        subset : object, default None
            subset to act on
        rN   )rP   rK   ÚgetattrÚ_infer_selectionrl   )r`   Úkeyr‚   ÚsubsetÚattrÚkwargsrN   Únew_wins           ra   Ú_gotitemzBaseWindow._gotitem  sp   € ð ˆ>Ø—X‘XˆFð 9=×8HÑ8HÖI°�$œ  dÓ+Ñ+ÐIˆÐIà×)Ñ)¨#¨vÓ6ˆ	Ø”$�t“*˜VÑC¨yÐC¸FÑCˆØˆùò	 Js   �Ac                óº   — || j                   v rt        j                  | |«      S || j                  v r| |   S t	        dt        | «      j                  › d|› d�«      ‚)Nú'z' object has no attribute ')Ú_internal_names_setÚobjectÚ__getattribute__rP   ÚAttributeErrorrl   rr   )r`   rš   s     ra   Ú__getattr__zBaseWindow.__getattr__,  sd   € Ø�4×+Ñ+Ñ+Ü×*Ñ*¨4°Ó6Ð6Ø�4—8‘8ÑØ˜‘:ÐäØ”�T“
×#Ñ#Ð$Ð$?À¸vÀQÐGó
ð 	
rc   c                ó6   — | j                   j                  «       S ©N)rP   Ú_dir_additions©r`   s    ra   r§   zBaseWindow._dir_additions6  s   € Ø�x‰x×&Ñ&Ó(Ð(rc   c                ó†   ‡ — ˆ fd„‰ j                   D «       }dj                  |«      }t        ‰ «      j                  › d|› d�S )z@
        Provide a nice str repr of our rolling object.
        c              3  ój   •K  — | ]*  }t        ‰|d «      �|d   dk7  r|› dt        ‰|«      › �–— Œ, y ­w)Nr   Ú_ú=)r–   )Ú.0Ú	attr_namer`   s     €ra   ú	<genexpr>z&BaseWindow.__repr__.<locals>.<genexpr>=  sF   øè ø€ ò 
àÜ�t˜Y¨Ó-Ð9¸iÈ¹lÈcÒ>Qð ˆk˜œ7 4¨Ó3Ð4Ô5ñ
ùs   ƒ03ú,z [ú])rK   Újoinrl   rr   )r`   Ú
attrs_listÚattrss   `  ra   Ú__repr__zBaseWindow.__repr__9  sF   ø€ ó
à!×-Ñ-ô
ˆ
ð
 —‘˜Ó$ˆÜ�t“*×%Ñ%Ð& b¨¨¨qÐ1Ð1rc   c              #  óÊ  K  — | j                   j                  | j                  «      }| j                  |«      }| j	                  «       }|j                  t        |«      | j                  | j                  | j                  | j                  ¬«      \  }}| j                  ||t        |«      «       t        ||d¬«      D ]"  \  }}|j                  t        ||«         }|–— Œ$ y ­w)N©Ú
num_valuesrU   rV   rR   rS   T)Ústrict)r�   Úset_axisrM   r”   Ú_get_window_indexerro   rw   rU   rV   rR   rS   r{   ÚzipÚilocÚslice)r`   rP   Úindexerrx   ry   ÚsÚer}   s           ra   Ú__iter__zBaseWindow.__iter__E  sÉ   è ø€ Ø× Ñ ×)Ñ)¨$¯(©(Ó3ˆØ×Ñ Ó$ˆØ×*Ñ*Ó,ˆà×.Ñ.Ü˜3“xØ×(Ñ(Ø—;‘;Ø—;‘;Ø—‘ð /ó 
‰
ˆˆsð 	×!Ñ! %¨¬c°#«hÔ7ä˜˜s¨4Ô0ò 	‰DˆAˆqØ—X‘Xœe A q›kÑ*ˆFØ‹Lñ	ùs   ‚C!C#c                óD  — t        |j                  «      st        |j                  «      r/t        dt	        | «      j
                  › d|j                  › d�«      ‚	 t        |t        «      r0|j                  t        j                  t        j                  ¬«      }nt        |«      }t        j                  |«      }|j!                  «       r%t        j"                  |t        j                  |«      }|S # t        t        f$ r}t        d|j                  › �«      |‚d}~ww xY w)z1Convert input to numpy arrays for Cython routineszops for z for this dtype z is not implemented)Úna_valuezcannot handle this type -> N)r   rƒ   r   r„   rl   rr   r[   r"   Úto_numpyÚnpÚfloat64Únanr   r]   rk   ÚisinfÚanyÚwhere)r`   ÚvaluesÚerrÚinfs       ra   Ú_prep_valueszBaseWindow._prep_valuesW  së   € ä˜vŸ|™|Ô,Ô0GÈÏÉÔ0Uô
 &Øœ4 ›:×.Ñ.Ð/ð 0ØŸ™˜Ð&9ð;óð ð	SÜ˜&¤.Ô1ØŸ™¬¯©¼b¿f¹f˜ÓE‘ä'¨Ó/�ô
 �h‰h�vÓˆØ�7‰7Œ9Ü—X‘X˜c¤2§6¡6¨6Ó2ˆFàˆøô œIÐ&ò 	SÜÐ9¸&¿,¹,¸ÐHÓIÈsÐRûð	Sús   ÁAC2 Ã2DÄDÄDc                óX  — ddl m} | j                  ��| j                  j	                  |j
                  «      sñ| j                  j                  } || j                  | j                  j
                  |d¬«      }||j                  v r|||<   y ||j
                  j                  v ry || j                  j                  v rf| j                  j                  }|j                  }|j                  |«      }|j                  |d | «      }	t        |	«      }
|j                  |
||«       y |||<   y y y )Nr   ©rC   F©rZ   r…   Úcopy)ÚpandasrC   rQ   rM   ÚequalsrZ   r…   rP   r\   Únamesr�   Úget_locÚintersectionrw   Úinsert)r`   r}   rP   rC   r…   Ú	extra_colÚold_colsÚnew_colsÚold_locÚoverlapÚnew_locs              ra   Ú_insert_on_columnzBaseWindow._insert_on_columns  sù   € õ 	"à�7‰7Ñ t§x¡x§¡°s·y±yÔ'AØ—8‘8—=‘=ˆDÙ˜tŸx™x¨t¯x©x¯~©~ÀDÈuÔUˆIØ�v—~‘~Ñ%à(��t’Ø˜Ÿ™×+Ñ+Ñ+ØØ˜×+Ñ+×3Ñ3Ñ3à×-Ñ-×5Ñ5�Ø!Ÿ>™>�Ø"×*Ñ*¨4Ó0�Ø"×/Ñ/°¸¸'Ð0BÓC�Ü˜g›,�Ø—‘˜g t¨YÕ7ð  )��t’ð% (BÐrc   c                óZ  — t        | j                  t        t        t        f«      r| j                  j
                  S t        | j                  j                  t        «      rL| j                  j                  j                  dv r*| j                  j                  t        j                  ¬«      S y )NÚmM©rƒ   )r[   rM   r+   r(   r,   Úasi8rƒ   r   ÚkindrÅ   rÆ   Úint64r¨   s    ra   Ú_index_arrayzBaseWindow._index_arrayŒ  sm   € ô �d—h‘h¤¬m¼^Ð LÔMØ—8‘8—=‘=Ð Ü˜Ÿ™Ÿ™¬
Ô3¸¿¹¿¹×8KÑ8KÈtÑ8SØ—8‘8×$Ñ$¬2¯8©8Ð$Ó4Ð4Ørc   c                óÎ   — |j                   d   dk(  r|j                   d   dkD  rt        d«      ‚|j                   d   dk(  r|j                  d«      S | j                  ||«       |S )zValidate and finalize result.rv   r   úNo numeric types to aggregaterÇ   )Úshaper   Úastyperà   )r`   ÚoutrP   s      ra   Ú_resolve_outputzBaseWindow._resolve_output•  sa   € à�9‰9�Q‰<˜1Ò §¡¨1¡°Ò!1ÜÐ;Ó<Ð<Ø�9‰9�Q‰<˜1ÒØ—:‘:˜iÓ(Ð(à×Ñ˜s CÔ(Øˆ
rc   c                óê   — t        | j                  t        «      r| j                  S | j                  �,t	        | j
                  | j                  | j                  ¬«      S t        | j                  ¬«      S )z[
        Return an indexer class that will compute the window start and end bounds
        )Úindex_arrayÚwindow_sizerV   )rð   )r[   rT   r$   rY   r'   rç   rV   r%   r¨   s    ra   r»   zBaseWindow._get_window_indexerŸ  s_   € ô �d—k‘k¤;Ô/Ø—;‘;ÐØ×ÑÐ(Ü(Ø ×-Ñ-Ø ×-Ñ-Ø—{‘{ôð ô
 "¨d¯k©kÔ:Ð:rc   c                ó€  — | j                  | j                  «      }|dk(  rt        |«      j                  t        «      }	 | j                  |j                  «      } ||«      }| j                  |j                  |«      }|j                  |||j                  ¬«      S # t        t        f$ r}t        d«      |‚d}~ww xY w)z5
        Series version of _apply_columnwise
        Úcountré   N©rZ   r…   )r”   r�   r   rë   ÚintrÏ   Ú_valuesrk   r„   r   r~   rZ   Ú_constructorr…   )r`   Úhomogeneous_funcr…   rP   rÌ   rÍ   r}   rZ   s           ra   Ú_apply_serieszBaseWindow._apply_series­  sµ   € ð ×Ñ × 2Ñ 2Ó3ˆà�7Š?ä˜“*×#Ñ#¤CÓ(ˆCð	FØ×&Ñ& s§{¡{Ó3ˆFñ " &Ó)ˆØ×)Ñ)¨#¯)©)°VÓ<ˆØ×Ñ ¨e¸#¿(¹(ÐÓCÐCøô Ô.Ð/ò 	FÜÐ;Ó<À#ÐEûð	Fús   Á B ÂB=Â,B8Â8B=c                óJ  — | j                  ||«       | j                  j                  dk(  r| j                  ||«      S | j	                  | j                  |«      }|dk(  r=t        |«      j                  t        «      }|j                  j                  «       |_        g }g }t        |j                  «       «      D ]A  \  }}	 | j                  |«      } ||«      }
|j#                  |
«       |j#                  |«       ŒC | j%                  |j&                  t)        |«      dkD  r|d   nd«      }t+        |«      j-                  |||j.                  j1                  |«      d¬«      }| j3                  ||«      S # t        t        f$ r}	t        d|j                   › �«      |	‚d}	~	ww xY w)zl
        Apply the given function to the DataFrame broken down into homogeneous
        sub-frames.
        rv   rò   z#Cannot aggregate non-numeric type: Nr   F)rZ   r\   Úverify_integrity)r‡   r�   r‚   rø   r”   r   rë   rô   Ú_mgrÚconsolidateÚ	enumerateÚ_iter_column_arraysrÏ   rk   r„   r   rƒ   Úappendr~   rZ   rw   rl   Ú_from_arraysr\   Útakerí   )r`   r÷   r…   r†   rP   ÚtakerÚ
res_valuesÚiÚarrrÍ   ÚresrZ   Údfs                ra   Ú_apply_columnwisezBaseWindow._apply_columnwiseÁ  s•  € ð 	×#Ñ# D¨,Ô7Ø×Ñ×"Ñ" aÒ'Ø×%Ñ%Ð&6¸Ó=Ð=à×Ñ × 2Ñ 2°LÓAˆØ�7Š?ä˜“*×#Ñ#¤CÓ(ˆCØ—x‘x×+Ñ+Ó-ˆCŒHàˆØˆ
Ü × 7Ñ 7Ó 9Ó:ò 	‰FˆAˆsðØ×'Ñ'¨Ó,�ñ
 # 3Ó'ˆCØ×Ñ˜cÔ"Ø�L‰L˜�Oð	ð ×)Ñ)Ø�I‰I¬¨J«¸!Ò(;�z !’}Àó
ˆô �#‹Y×#Ñ#ØØØ—K‘K×$Ñ$ UÓ+Ø"ð	 $ó 
ˆð ×#Ñ# B¨Ó,Ð,øô% Ô2Ð3ò ÜØ9¸#¿)¹)¸ÐEóàðûðús   Ã E5Å5F"ÆFÆF"c                óî  — | j                   j                  dk(  rt        d«      ‚| j                  | j                   |«      }| j	                  |j                  «       «      } ||«      }| j                  |j                  |«      }|j                  d   t        |j                  «      k(  r|j                  n|j                  dd| j                  …   }|j                  |||¬«      }	| j                  |	|«      S )zT
        Apply the given function to the DataFrame across the entire object
        rv   z1method='table' not applicable for Series objects.N©rZ   r\   )r�   r‚   r]   r”   rÏ   rÅ   r~   rZ   rê   rw   r\   rS   rö   rí   )
r`   r÷   r…   r†   rP   rÌ   r}   rZ   r\   rì   s
             ra   Ú_apply_tablewisezBaseWindow._apply_tablewiseð  sÛ   € ð ×Ñ×"Ñ" aÒ'ÜÐPÓQÐQØ×Ñ × 2Ñ 2°LÓAˆØ×"Ñ" 3§<¡<£>Ó2ˆÙ! &Ó)ˆØ×)Ñ)¨#¯)©)°VÓ<ˆð �|‰|˜A‰¤# c§k¡kÓ"2Ò2ð �KŠKà—‘™\ §	¡	˜\Ñ*ð 	ð
 ×Ñ˜v¨U¸GÐÓDˆà×#Ñ# C¨Ó-Ð-rc   c                óò   — | j                  ||«      }|€	|}|€dn|}nCt        |t        t        f«      st	        d«      ‚|j
                  dk(  r|r| j                  |«      }t        |||t        |«      ¬«      S )ú]
        Apply the given pairwise function given 2 pandas objects (DataFrame/Series)
        Tz#other must be a DataFrame or Seriesr�   )Úpairwise)	r”   r[   r   r   r]   r‚   r�   r1   Úbool)r`   ÚtargetÚotherr  Úfuncr†   s         ra   Ú_apply_pairwisezBaseWindow._apply_pairwise  sy   € ð ×"Ñ" 6¨<Ó8ˆØˆ=ØˆEà'Ð/‘t°X‰HÜ˜E¤L´)Ð#<Ô=ÜÐBÓCÐCØ�Z‰Z˜1Š_¡Ø×+Ñ+¨EÓ2ˆEä! &¨%°ÄÀXÃÔOÐOrc   c                óò   ‡ ‡‡‡‡— ‰ j                  «       Š‰ j                  �‰ j                  n‰j                  Šdˆˆˆˆ ˆfd„}‰ j                  dk(  r‰ j	                  |||«      S ‰ j                  |||«      S )aÞ  
        Rolling statistical measure using supplied function.

        Designed to be used with passed-in Cython array-based functions.

        Parameters
        ----------
        func : callable function to apply
        name : str,
        numba_args : tuple
            args to be passed when func is a numba func
        **kwargs
            additional arguments for rolling function and window function

        Returns
        -------
        y : type of input
        c                óÀ   •— | j                   dk(  r| j                  «       S ˆˆˆˆˆfd„}t        j                  d¬«      5   || «      }d d d «       |S # 1 sw Y   S xY w)Nr   c                óÔ   •— ‰j                  t        | «      ‰‰j                  ‰j                  ‰j                  ¬«      \  }}‰j                  ||t        | «      «        ‰| ||‰g‰¢­Ž S )Nr·   )ro   rw   rV   rR   rS   r{   )Úxrx   ry   r  rU   Ú
numba_argsr`   Úwindow_indexers      €€€€€ra   Úcalcz9BaseWindow._apply.<locals>.homogeneous_func.<locals>.calcF  si   ø€ Ø+×=Ñ=Ü" 1›vØ +ØŸ;™;ØŸ;™;ØŸ™ð >ó ‘
��sð ×)Ñ)¨%°´c¸!³fÔ=á˜A˜u c¨;ÐD¸ÒDÐDrc   Úignore©Úall)ÚsizerÓ   rÆ   Úerrstate)rÌ   r  r}   r  rU   r  r`   r  s      €€€€€ra   r÷   z+BaseWindow._apply.<locals>.homogeneous_func@  s^   ø€ ð �{‰{˜aÒØ—{‘{“}Ð$÷
Eð 
Eô —‘ Ô*ñ &Ù˜f›�÷&ð ˆM÷&ð ˆMús   Á 	AÁArj   ©rÌ   ú
np.ndarray)r»   rU   rð   rX   r  r  )	r`   r  r…   r†   r  r›   r÷   rU   r  s	   ``  `  @@ra   Ú_applyzBaseWindow._apply  s~   ü€ ð4 ×1Ñ1Ó3ˆð ×ÑÐ+ð ×Òà×+Ñ+ð 	÷	ñ 	ð. �;‰;˜(Ò"Ø×)Ñ)Ð*:¸DÀ,ÓOÐOà×(Ñ(Ð)9¸4ÀÓNÐNrc   c                óÌ  — | j                  «       }| j                  �| j                  n|j                  }| j                  | j                  «      }| j                  |j                  «       «      }|j                  dk(  r|j                  dd«      }|j                  t        |«      || j                  | j                  | j                  ¬«      \  }}	| j                  ||	t        |«      «       t        j                   }
t        j"                  ||
fddit%        |«      ¤Ž} ||j&                  f||	|dœ|¤Žj&                  }| j)                  |j*                  |«      }|j                  dk(  r0|j-                  «       }|j/                  |||j0                  ¬«      }|S | j)                  |j2                  |j&                  «      }|j/                  |||¬«      }| j5                  ||«      S )	Nrv   éÿÿÿÿr·   Úis_grouped_kernelF)rx   ry   rU   ró   r
  )r»   rU   rð   r”   r�   rÏ   rÅ   r‚   Úreshapero   rw   rV   rR   rS   r{   r   Úfloat_dtype_mappingÚgenerate_shared_aggregatorr.   r?   r~   rZ   Úsqueezerö   r…   r\   rí   )r`   r  Úengine_kwargsÚfunc_kwargsr  rU   rP   rÌ   rx   ry   Údtype_mappingÚ
aggregatorr}   rZ   rì   r\   s                   ra   Ú_numba_applyzBaseWindow._numba_apply\  sÑ  € ð ×1Ñ1Ó3ˆð ×ÑÐ+ð ×Òà×+Ñ+ð 	ð
 ×Ñ × 2Ñ 2Ó3ˆØ×"Ñ" 3§<¡<£>Ó2ˆØ�;‰;˜!ÒØ—^‘^ B¨Ó*ˆFØ#×5Ñ5Ü˜6“{Ø#Ø—;‘;Ø—;‘;Ø—‘ð 6ó 
‰
ˆˆsð 	×!Ñ! %¨¬c°&«kÔ:ô
 !×4Ñ4ˆÜ×8Ñ8ØØñ
ð $ð
ô   Ó.ñ	
ˆ
ñ Ø�H‰Hð
Ø! s¸ñ
ØGRñ
ç
‰!ð 	ð ×)Ñ)¨#¯)©)°VÓ<ˆØ�8‰8�qŠ=Ø—^‘^Ó%ˆFØ×"Ñ" 6°¸S¿X¹XÐ"ÓFˆCØˆJà×/Ñ/°·±¸V¿X¹XÓFˆGØ×"Ñ" 6°ÀÐ"ÓHˆCØ×'Ñ'¨¨SÓ1Ð1rc   c                óè   — t        |fi |¤Ž\  }}}}t        | |||¬«      j                  «       }t        |t        «      r|r|j
                  d d …|f   }||_        |€| j                  |d||¬«      S |S )N©Úargsr›   F)Úrawr1  r›   )r!   r    Úaggr[   r   r½   r\   Úapply)r`   r  r1  r›   Ú
relabelingr\   Úorderr}   s           ra   Ú	aggregatezBaseWindow.aggregateŒ  sy   € Ü+;¸DÑ+KÀFÑ+KÑ(ˆ
�D˜' 5Ü% d¨D°tÀFÔK×OÑOÓQˆÜ�fœlÔ+±
Ø—[‘[¢ E Ñ*ˆFØ$ˆFŒNØˆ>Ø—:‘:˜d¨°DÀ�:ÓHÐHØˆrc   )NNFNNNNrj   )rP   rD   rU   ú
int | NonerV   úbool | NonerW   ú
str | NonerQ   zstr | Index | NonerR   r:  rS   r8  rX   ÚstrÚreturnÚNone©r<  r=  )rx   r!  ry   r!  rz   rô   r<  r=  r¦   )rZ   r)   r}   zSized | Noner<  r)   )r…   r;  r†   r  r<  r=  )rP   r;   r<  r;   ©F©rP   r;   r†   r  r<  r;   )rš   r;  )r<  r;  )r<  zIterator[Any])rÌ   r:   r<  r!  )r}   rB   rP   rB   r<  r=  )r<  znpt.NDArray[np.int64] | None)rì   rB   rP   rB   r<  rB   )r<  r$   )r÷   úCallable[..., ArrayLike]r…   r:  r<  rC   )r÷   rA  r…   r;  r†   r  r<  úDataFrame | Series)NF)r÷   rA  r…   r:  r†   r  r<  rB  ©r  rB  r  úDataFrame | Series | Noner  r9  r  zFCallable[[DataFrame | Series, DataFrame | Series], DataFrame | Series]r†   r  r<  rB  ©F© )r  úCallable[..., Any]r…   r;  r†   r  r  útuple[Any, ...])r  rG  r*  údict[str, bool] | None)"rr   Ú
__module__Ú__qualname__Ú__doc__rK   Ú__annotations__Ú	frozensetrL   rb   r_   r{   r~   r‡   r�   r”   r�   r¤   r§   rµ   rÂ   rÏ   rà   Úpropertyrç   rí   r»   rø   r  r  r  r"  r.  r7  r3  rF  rc   ra   rI   rI   u   sX  … ÙAà€K�ÓÙ&/£k€JÐ#Ó1Ø	ƒJð
 Ø"&Ø#Ø#Ø!%Ø!ØØð%ð ñ%àð%ð  ð	%ð
 ð%ð ð%ð ð%ð ð%ð ð%ð ð%ð 
ó%óN)6ðVØðØ&0ðØ<?ðà	óô
óó(ô	óó0
ò)ó
2óó$ó8)ð2 òó ðóó;ð NRðDØ 8ðDØ@JðDà	óDð0 #ð	--à2ð--ð ð--ð ð	--ð
 
ó--ðd  Ø"ð	.à2ð.ð ð.ð ð	.ð
 
ó.ð0Pà"ðPð )ðPð ð	Pð
 UðPð ðPð 
óPð6 #Ø&(ð;Oà ð;Oð ð;Oð ð	;Oð
 $ó;Oð@ 15ð.2à ð.2ð .ó.2ó`ð �Crc   rI   rD   c                  óÀ   ‡ — e Zd ZU dZded<   ded<   dgZded<   dd	œ	 	 	 	 	 	 	 dˆ fd
„Z	 	 d	 	 	 	 	 	 	 	 	 dˆ fd„Z	 	 	 	 	 	 	 	 	 	 	 	 dˆ fd„Zddˆ fd„Z	dˆ fd„	Z
ˆ xZS )ÚBaseWindowGroupByz3
    Provide the groupby windowing facilities.
    rF   Ú_grouperr  Ú	_as_indexrJ   rK   T)rS  c               ó  •— ddl m} t        ||«      st        d«      ‚|| _        || _        |j                  | j                  j                  d¬«      }|j                  d«      �t        d«      ‚t        ‰| �,  |g|¢­i |¤Ž y )Nr   rE   zMust pass a BaseGrouper object.r  ©r\   ÚerrorsrS   z step not implemented for groupby)Úpandas.core.groupby.opsrF   r[   r]   rR  rS  ÚdroprÖ   Úgetr„   Úsuperrb   )r`   rP   rR  rS  r1  r›   rF   Ú	__class__s          €ra   rb   zBaseWindowGroupBy.__init__¢  s|   ø€ õ 	8ä˜( KÔ0ÜÐ>Ó?Ð?Ø ˆŒØ"ˆŒð �h‰h˜tŸ}™}×2Ñ2¸8ˆhÓDˆà�:‰:�fÓÐ)Ü%Ð&HÓIÐIÜ‰Ñ˜Ð.˜tÒ. vÓ.rc   c           	     óö  •— t        ‰| �  ||||fi |¤Ž}| j                  j                  }g |j                  ¢}t        j
                  | j                  j                  «      }	|	|z   }
| j                  j                  D �cg c](  }|| j                  j                  j                  vs|€|‘Œ* }}t        |«      t        |	«      k7  r|j                  |d¬«      }| j                  j                  }t        j
                  | j                  j                  «      }| j                  j                  j                  «       }|rt        j                  t        |«      «      }n%t        j                   g t        j"                  ¬«      }|D �cg c]  }|j%                  |«      ‘Œ }}|�|j%                  |«      }t'        |t(        «      st)        j*                  |g«      }|j-                  t        |j                  «      «       |j-                  t        |j                  «      «       t)        |||
d¬«      }||_        | j.                  s-|j1                  t        t3        t        |	«      «      «      ¬«      }|S c c}w c c}w )Nr  rU  rã   F©rÖ   rú   )Úlevel)rZ  r"  rP   rZ   rÖ   rÓ   rR  rw   rX  ÚcodesÚlevelsÚindicesrÌ   rÆ   ÚconcatenateÚlistÚarrayÚintpr  r[   r*   Úfrom_arraysÚextendrS  Úreset_indexÚrange)r`   r  r…   r†   r  r›   r}   Úgrouped_object_indexÚgrouped_index_nameÚgroupby_keysÚresult_index_namesr˜   Údrop_columnsr_  r`  Úgroup_indicesr¿   ÚcÚidxÚresult_indexr[  s                       €ra   r"  zBaseWindowGroupBy._apply¹  s  ø€ ô ‘‘ØØØØñ	
ð
 ñ
ˆð  $Ÿx™xŸ~™~ÐØ:Ð3×9Ñ9Ð:ÐÜ—y‘y §¡×!4Ñ!4Ó5ˆØ)Ð,>Ñ>Ðð —}‘}×*Ñ*ö
àØ˜$Ÿ(™(Ÿ.™.×.Ñ.Ñ.°#°+ò ð
ˆð 
ô ˆ|Ó¤ LÓ 1Ò1à—[‘[¨¸h�[ÓGˆFà—‘×#Ñ#ˆÜ—‘˜4Ÿ=™=×/Ñ/Ó0ˆàŸ™×-Ñ-×4Ñ4Ó6ˆÙÜ—n‘n¤T¨-Ó%8Ó9‰Gä—h‘h˜r¬¯©Ô1ˆGØ*/Ö0 Q�—‘˜•Ð0ˆÐ0ð  Ð+Ø&×+Ñ+¨GÓ4ˆCÜ˜c¤:Ô.Ü ×,Ñ,¨c¨UÓ3�Ø�L‰Lœ˜cŸi™i›Ô)Ø�M‰Mœ$˜sŸz™zÓ*Ô+ä!Ø�EÐ!3Àeô
ˆð $ˆŒØ�~Š~Ø×'Ñ'¬d´5¼¸\Ó9JÓ3KÓ.LÐ'ÓMˆFØˆùòI
ùò$ 1s   Á?-I1ÆI6c                óÚ  •‡— |j                  | j                  j                  d¬«      }t        ‰| �  |‰|||«      }‰��Lt        ˆfd„| j                  j                  j                  «       D «       «      �st        |«      }t        | j                  j                  j                  «       D �cg c],  }|j                  |«      j                  |j                  «      ‘Œ. c}«      }d„ | j                  j                  j                  «       D «       }	g }
g }t        t        t!        |	ddiŽ«      D ][  }t#        j$                  t#        j&                  |«      |«      }t)        |«      \  }}|
j+                  |«       |j+                  |«       Œ] nï| j                  j,                  }
| j                  j.                  }| j                  j                  j                  «       }|rt#        j0                  t        |«      «      }n%t#        j&                  g t"        j2                  ¬«      }|j4                  dk(  rd}nt        |j6                  «      }|
D �cg c]'  }t#        j$                  |j                  |«      |«      ‘Œ) }
}t9        |j                  t:        «      r^t        |j                  j,                  «      }t        |j                  j.                  «      }t        |j                  j                  «      }n5t)        |j                  «      \  }}|g}|g}|j                  j<                  g}|
|z   }||z   }| j                  j                  |z   }t;        |||d	¬
«      }||_        |S c c}w c c}w )r  r  rU  c              3  óL   •K  — | ]  }t        |«      t        ‰«      k(  –— Œ y ­wr¦   )rw   )r­   Úgroupr  s     €ra   r¯   z4BaseWindowGroupBy._apply_pairwise.<locals>.<genexpr>  s#   øè ø€ ò )
Ø).ŒC�‹Jœ#˜e›*Õ$ñ)
ùs   ƒ!$c              3  óF   K  — | ]  }t        j                  |«      –— Œ y ­wr¦   )ÚcomÚmaybe_make_list)r­   Úpairs     ra   r¯   z4BaseWindowGroupBy._apply_pairwise.<locals>.<genexpr>  s    è ø€ ò Ø.2”×#Ñ# D×)ñùs   ‚!r¹   Trã   rv   Fr]  )rX  rR  rÖ   rZ  r  r  ra  rÌ   rw   r-   r  r’   rZ   rq   Úmaprc  r¼   rÆ   Úrepeatrd  r   rÿ   r_  r`  rb  re  r‚   r\   r[   r*   r…   )r`   r  r  r  r  r†   r}   Úold_result_lenÚ
gb_indicesÚgb_pairsÚgroupby_codesÚgroupby_levelsÚgb_level_pairÚlabelsr_  r`  ro  r¿   Ú	repeat_byrp  Úresult_codesÚresult_levelsÚresult_namesÚ	idx_codesÚ
idx_levelsrr  r[  s     `                       €ra   r  z!BaseWindowGroupBy._apply_pairwiseö  sÔ  ù€ ð —‘ T§]¡]×%8Ñ%8À�ÓJˆÜ‘Ñ(¨°¸À$ÈÓUˆàÑ¤Só )
Ø26·-±-×2GÑ2G×2NÑ2NÓ2Pô)
õ &
ô ! ›[ˆNÜð '+§m¡m×&;Ñ&;×&BÑ&BÓ&Döà"ð —K‘K 
Ó+×3Ñ3°F·L±LÕAòóˆFñØ6:·m±m×6KÑ6K×6PÑ6PÓ6RôˆHð ˆMØˆNä!$¤T¬3°Ð+FÀÑ+FÓ!Gò .�ÜŸ™¤2§8¡8¨MÓ#:¸NÓK�Ü )¨&Ó 1‘��vØ×$Ñ$ UÔ+Ø×%Ñ% fÕ-ñ	.ð !ŸM™M×/Ñ/ˆMð "Ÿ]™]×1Ñ1ˆNà ŸM™M×1Ñ1×8Ñ8Ó:ˆMÙÜŸ.™.¬¨mÓ)<Ó=‘äŸ(™( 2¬R¯W©WÔ5�à�{‰{˜aÒØ‘	ä §¡Ó/�	à?LöØ:;”—	‘	˜!Ÿ&™& ›/¨9Õ5ðˆMð ô �f—l‘l¤JÔ/Ü §¡× 2Ñ 2Ó3ˆLÜ  §¡×!4Ñ!4Ó5ˆMÜ §¡× 2Ñ 2Ó3‰Lä$-¨f¯l©lÓ$;Ñ!ˆI�zØ%˜;ˆLØ'˜LˆMØ"ŸL™L×-Ñ-Ð.ˆLð % |Ñ3ˆØ&¨Ñ6ˆØ—}‘}×*Ñ*¨\Ñ9ˆä!Ø˜<¨|Èeô
ˆð $ˆŒØˆùòuùòFs   Â-1M#É,M(c                ó  •— |j                   snt        j                  t        | j                  j
                  j                  «       «      «      j                  t        j                  «      }|j                  |«      }t        ‰| �-  ||«      S )r�   )ÚemptyrÆ   rb  rc  rR  ra  rÌ   rë   ræ   r  rZ  r”   )r`   rP   r†   Úgroupby_orderr[  s       €ra   r”   zBaseWindowGroupBy._create_dataJ  sf   ø€ ð �yŠyÜŸN™N¬4°·±×0EÑ0E×0LÑ0LÓ0NÓ+OÓP×WÑWÜ—‘óˆMð —(‘(˜=Ó)ˆCÜ‰wÑ# C¨Ó6Ð6rc   c                óŠ   •— | j                   �%| j                  j                  | j                  «      }t        ‰| �  |||¬«      S )N)r™   )rQ   rP   Ú	set_indexrM   rZ  r�   )r`   r˜   r‚   r™   r[  s       €ra   r�   zBaseWindowGroupBy._gotitemX  s>   ø€ ð �7‰7Ðà—X‘X×'Ñ'¨¯©Ó1ˆFÜ‰wÑ  T°&ÐÓ9Ð9rc   )rP   rB  rR  rF   rS  r  r<  r=  rE  )
r  rG  r…   r;  r†   r  r  rH  r<  rB  rC  r?  r@  r¦   )rr   rJ  rK  rL  rM  rK   rb   r"  r  r”   r�   Ú__classcell__©r[  s   @ra   rQ  rQ  ™  sæ   ø… ñð ÓØƒOØ(˜\€K�Ó)ð ñ/àð/ð ð	/ð
 ð/ð 
õ/ð6 #Ø&(ð;à ð;ð ð;ð ð	;ð
 $ð;ð 
õ;ðzRà"ðRð )ðRð ð	Rð
 UðRð ðRð 
õRöh7÷:ñ :rc   rQ  zpandas.api.typingc                  ó„   ‡ — e Zd ZdZg d¢Zdˆ fd„Zdd„Z	 	 d	 	 	 	 	 	 	 dd„Zdd„ZeZ	ddd„Z
ddd„Zddd	„Zddd
„Zˆ xZS )ÚWindowaE  
    Provide rolling window calculations.

    Parameters
    ----------
    window : int, timedelta, str, offset, or BaseIndexer subclass
        Interval of the moving window.

        If an integer, the delta between the start and end of each window.
        The number of points in the window depends on the ``closed`` argument.

        If a timedelta, str, or offset, the time period of each window. Each
        window will be a variable sized based on the observations included in
        the time-period. This is only valid for datetimelike indexes.
        To learn more about the offsets & frequency strings, please see
        :ref:`this link<timeseries.offset_aliases>`.

        If a BaseIndexer subclass, the window boundaries
        based on the defined ``get_window_bounds`` method. Additional rolling
        keyword arguments, namely ``min_periods``, ``center``, ``closed`` and
        ``step`` will be passed to ``get_window_bounds``.

    min_periods : int, default None
        Minimum number of observations in window required to have a value;
        otherwise, result is ``np.nan``.

        For a window that is specified by an offset, ``min_periods`` will default to 1.

        For a window that is specified by an integer, ``min_periods`` will default
        to the size of the window.

    center : bool, default False
        If False, set the window labels as the right edge of the window index.

        If True, set the window labels as the center of the window index.

    win_type : str, default None
        If ``None``, all points are evenly weighted.

        If a string, it must be a valid `scipy.signal window function
        <https://docs.scipy.org/doc/scipy/reference/signal.windows.html#module-scipy.signal.windows>`__.

        Certain Scipy window types require additional parameters to be passed
        in the aggregation function. The additional parameters must match
        the keywords specified in the Scipy window type method signature.

    on : str, optional
        For a DataFrame, a column label or Index level on which
        to calculate the rolling window, rather than the DataFrame's index.

        For integer ``window`` values, the window bounds are based on the number
        of observations and are not calculated using the values of the
        ``on`` column. The ``on`` column is excluded from the aggregation,
        but is included in the result when its values differ from the
        object's index.

    closed : str, default None
        Determines the inclusivity of points in the window

        If ``'right'``, uses the window (first, last] meaning the last point
        is included in the calculations.

        If ``'left'``, uses the window [first, last) meaning the first point
        is included in the calculations.

        If ``'both'``, uses the window [first, last] meaning all points in
        the window are included in the calculations.

        If ``'neither'``, uses the window (first, last) meaning the first
        and last points in the window are excluded from calculations.

        () and [] are referencing open and closed set
        notation respetively.

        Default ``None`` (``'right'``).

    step : int, default None
        Evaluate the window at every ``step`` result, equivalent to slicing as
        ``[::step]``. ``window`` must be an integer. Using a step argument other
        than None or 1 will produce a result with a different shape than the input.

    method : str {'single', 'table'}, default 'single'

        Execute the rolling operation per single column or row (``'single'``)
        or over the entire object (``'table'``).

        This argument is only implemented when specifying ``engine='numba'``
        in the method call.

    Returns
    -------
    pandas.api.typing.Window or pandas.api.typing.Rolling
        An instance of Window is returned if ``win_type`` is passed. Otherwise,
        an instance of Rolling is returned.

    See Also
    --------
    expanding : Provides expanding transformations.
    ewm : Provides exponential weighted functions.

    Notes
    -----
    See :ref:`Windowing Operations <window.generic>` for further usage details
    and examples.

    Examples
    --------
    >>> df = pd.DataFrame({"B": [0, 1, 2, np.nan, 4]})
    >>> df
         B
    0  0.0
    1  1.0
    2  2.0
    3  NaN
    4  4.0

    **window**

    Rolling sum with a window length of 2 observations.

    >>> df.rolling(2).sum()
         B
    0  NaN
    1  1.0
    2  3.0
    3  NaN
    4  NaN

    Rolling sum with a window span of 2 seconds.

    >>> df_time = pd.DataFrame(
    ...     {"B": [0, 1, 2, np.nan, 4]},
    ...     index=[
    ...         pd.Timestamp("20130101 09:00:00"),
    ...         pd.Timestamp("20130101 09:00:02"),
    ...         pd.Timestamp("20130101 09:00:03"),
    ...         pd.Timestamp("20130101 09:00:05"),
    ...         pd.Timestamp("20130101 09:00:06"),
    ...     ],
    ... )

    >>> df_time
                           B
    2013-01-01 09:00:00  0.0
    2013-01-01 09:00:02  1.0
    2013-01-01 09:00:03  2.0
    2013-01-01 09:00:05  NaN
    2013-01-01 09:00:06  4.0

    >>> df_time.rolling("2s").sum()
                           B
    2013-01-01 09:00:00  0.0
    2013-01-01 09:00:02  1.0
    2013-01-01 09:00:03  3.0
    2013-01-01 09:00:05  NaN
    2013-01-01 09:00:06  4.0

    Rolling sum with forward looking windows with 2 observations.

    >>> indexer = pd.api.indexers.FixedForwardWindowIndexer(window_size=2)
    >>> df.rolling(window=indexer, min_periods=1).sum()
         B
    0  1.0
    1  3.0
    2  2.0
    3  4.0
    4  4.0

    **min_periods**

    Rolling sum with a window length of 2 observations, but only needs a minimum of 1
    observation to calculate a value.

    >>> df.rolling(2, min_periods=1).sum()
         B
    0  0.0
    1  1.0
    2  3.0
    3  2.0
    4  4.0

    **center**

    Rolling sum with the result assigned to the center of the window index.

    >>> df.rolling(3, min_periods=1, center=True).sum()
         B
    0  1.0
    1  3.0
    2  3.0
    3  6.0
    4  4.0

    >>> df.rolling(3, min_periods=1, center=False).sum()
         B
    0  0.0
    1  1.0
    2  3.0
    3  3.0
    4  6.0

    **step**

    Rolling sum with a window length of 2 observations, minimum of 1 observation to
    calculate a value, and a step of 2.

    >>> df.rolling(2, min_periods=1, step=2).sum()
         B
    0  0.0
    2  3.0
    4  4.0

    **win_type**

    Rolling sum with a window length of 2, using the Scipy ``'gaussian'``
    window type. ``std`` is required in the aggregation function.

    >>> df.rolling(2, win_type="gaussian").sum(std=3)
              B
    0        NaN
    1   0.986207
    2   2.958621
    3        NaN
    4        NaN

    **on**

    Rolling sum with a window length of 2 days.

    >>> df = pd.DataFrame(
    ...     {
    ...         "A": [
    ...             pd.to_datetime("2020-01-01"),
    ...             pd.to_datetime("2020-01-01"),
    ...             pd.to_datetime("2020-01-02"),
    ...         ],
    ...         "B": [1, 2, 3],
    ...     },
    ...     index=pd.date_range("2020", periods=3),
    ... )

    >>> df
                        A  B
    2020-01-01 2020-01-01  1
    2020-01-02 2020-01-01  2
    2020-01-03 2020-01-02  3

    >>> df.rolling("2D", on="A").sum()
                        A    B
    2020-01-01 2020-01-01  1.0
    2020-01-02 2020-01-01  3.0
    2020-01-03 2020-01-02  6.0
    ©rT   rU   rV   rW   rQ   rR   rS   rX   c                óü  •— t         ‰| �  «        t        | j                  t        «      st        d| j                  › �«      ‚t        dd¬«      }t        || j                  d «      | _        | j                  €t        d| j                  › �«      ‚t        | j                  t        «      rt        d«      ‚t        | j                  «      r| j                  dk  rt        d«      ‚| j                  dk7  rt        d	«      ‚y )
NzInvalid win_type zscipy.signal.windowsz,Scipy is required to generate window weight.)Úextraz6BaseIndexer subclasses not implemented with win_types.r   ú&window must be an integer 0 or greaterrj   z+'single' is the only supported method type.)rZ  r_   r[   rW   r;  r]   r   r–   Ú_scipy_weight_generatorrT   r$   r„   r   rX   )r`   Úsignalr[  s     €ra   r_   zWindow._validatem  sÜ   ø€ Ü‰ÑÔä˜$Ÿ-™-¬Ô-ÜÐ0°·±°Ð@ÓAÐAÜ+Ø"Ð*Xô
ˆô (/¨v°t·}±}ÀdÓ'KˆÔ$Ø×'Ñ'Ð/ÜÐ0°·±°Ð@ÓAÐAä�d—k‘k¤;Ô/Ü%ØHóð ô ˜$Ÿ+™+Ô&¨$¯+©+¸ª/ÜÐEÓFÐFà�;‰;˜(Ò"Ü%Ð&SÓTÐTð #rc   c                ól   — |dkD  r.t        |d«      g}t        j                  |t        |«         «      }|S )zT
        Center the result in the window for weighted rolling aggregations.
        r   N)r¾   rÆ   rÓ   Útuple)r`   r}   ÚoffsetÚlead_indexers       ra   Ú_center_windowzWindow._center_windowƒ  s7   € ð �AŠ:Ü! &¨$Ó/Ð0ˆLÜ—W‘W˜V¤E¨,Ó$7Ñ8Ó9ˆFØˆrc   c                óÚ   ‡ ‡‡‡—  ‰ j                   ‰ j                  fi |¤ŽŠ‰ j                  rt        ‰«      dz
  dz  ndŠdˆˆˆ ˆfd„}‰ j	                  |||«      dd‰ j
                  …   S )a+  
        Rolling with weights statistical measure using supplied function.

        Designed to be used with passed-in Cython array-based functions.

        Parameters
        ----------
        func : callable function to apply
        name : str,
        numeric_only : bool, default False
            Whether to only operate on bool, int, and float columns
        numba_args : tuple
            unused
        **kwargs
            additional arguments for scipy windows if necessary

        Returns
        -------
        y : type of input
        rv   r�   r   c                ó  •— | j                   dk(  r| j                  «       S ˆˆˆˆfd„}t        j                  d¬«      5  t        j                   || «      «      }d d d «       ‰j
                  r‰j                  ‰«      }S # 1 sw Y   Œ)xY w)Nr   c                óØ   •— t        j                  ‰t         j                  «      }t        j                  | |f«      }  ‰| ‰‰j                  �‰j                  «      S t        ‰«      «      S r¦   )rÆ   ÚfullrÈ   rb  rU   rw   )r  Úadditional_nansr  rš  r`   rT   s     €€€€ra   r  z5Window._apply.<locals>.homogeneous_func.<locals>.calc´  sf   ø€ Ü"$§'¡'¨&´"·&±&Ó"9�Ü—N‘N A Ð#7Ó8�ÙØØØ(,×(8Ñ(8Ð(D�D×$Ñ$óð ô KNÈfË+óð rc   r  r  )r  rÓ   rÆ   r  ÚasarrayrV   rœ  )rÌ   r  r}   r  rš  r`   rT   s      €€€€ra   r÷   z'Window._apply.<locals>.homogeneous_func®  sw   ø€ ð �{‰{˜aÒØ—{‘{“}Ð$÷ô —‘ Ô*ñ 2äŸ™¡D¨£LÓ1�÷2ð �{Š{Ø×,Ñ,¨V°VÓ<�àˆM÷2ð 2ús   ¿BÂBNr   )r–  rT   rV   rw   r  rS   )	r`   r  r…   r†   r  r›   r÷   rš  rT   s	   ``     @@ra   r"  zWindow._applyŒ  sv   û€ ð: .�×-Ñ-Ø�K‰Kñ
Ø!ñ
ˆð ,0¯;ª;”#�f“+ ‘/ aÒ'¸Aˆ÷	ð 	ð0 ×%Ñ%Ð&6¸¸lÓKÙˆt�y‰yˆLñ
ð 	
rc   c                óT   — t        | |||¬«      j                  «       }|€ || «      }|S )ao	  
        Aggregate using one or more operations over the specified axis.

        Parameters
        ----------
        func : function, str, list or dict
            Function to use for aggregating the data. If a function, must either
            work when passed a Series/DataFrame or
            when passed to Series/DataFrame.apply.

            Accepted combinations are:

            - function
            - string function name
            - list of functions and/or function names, e.g. ``[np.sum, 'mean']``
            - dict of axis labels -> functions, function names or list of such.

        *args
            Positional arguments to pass to `func`.
        **kwargs
            Keyword arguments to pass to `func`.

        Returns
        -------
        scalar, Series or DataFrame

            The return can be:

            * scalar : when Series.agg is called with single function
            * Series : when DataFrame.agg is called with a single function
            * DataFrame : when DataFrame.agg is called with several functions

        See Also
        --------
        DataFrame.aggregate : Similar DataFrame method.
        Series.aggregate : Similar Series method.

        Notes
        -----
        The aggregation operations are always performed over an axis, either the
        index (default) or the column axis. This behavior is different from
        `numpy` aggregation functions (`mean`, `median`, `prod`, `sum`, `std`,
        `var`), where the default is to compute the aggregation of the flattened
        array, e.g., ``numpy.mean(arr_2d)`` as opposed to
        ``numpy.mean(arr_2d, axis=0)``.

        `agg` is an alias for `aggregate`. Use the alias.

        Functions that mutate the passed object can produce unexpected
        behavior or errors and are not supported. See :ref:`gotchas.udf-mutation`
        for more details.

        A passed user-defined-function will be passed a Series for evaluation.

        If ``func`` defines an index relabeling, ``axis`` must be ``0`` or ``index``.

        Examples
        --------
        >>> df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6], "C": [7, 8, 9]})
        >>> df
        A  B  C
        0  1  4  7
        1  2  5  8
        2  3  6  9

        >>> df.rolling(2, win_type="boxcar").agg("mean")
            A    B    C
        0  NaN  NaN  NaN
        1  1.5  4.5  7.5
        2  2.5  5.5  8.5
        r0  )r    r3  )r`   r  r1  r›   r}   s        ra   r7  zWindow.aggregateÊ  s1   € ôP & d¨D°tÀFÔK×OÑOÓQˆØˆ>á˜$“ZˆFàˆrc   c                óN   — t         j                  } | j                  |fd|dœ|¤ŽS )a™  
        Calculate the rolling weighted window sum.

        The window type is determined by the ``win_type`` parameter specified
        in :meth:`DataFrame.rolling` or :meth:`Series.rolling`. Additional
        keyword arguments are passed to the SciPy window function.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

        **kwargs
            Keyword arguments to configure the ``SciPy`` weighted window type.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.sum : Aggregating sum for Series.
        DataFrame.sum : Aggregating sum for DataFrame.

        Examples
        --------
        >>> ser = pd.Series([0, 1, 5, 2, 8])

        To get an instance of :class:`~pandas.core.window.rolling.Window` we need
        to pass the parameter `win_type`.

        >>> type(ser.rolling(2, win_type="gaussian"))
        <class 'pandas.api.typing.Window'>

        In order to use the `SciPy` Gaussian window we need to provide the parameters
        `M` and `std`. The parameter `M` corresponds to 2 in our example.
        We pass the second parameter `std` as a parameter of the following method
        (`sum` in this case):

        >>> ser.rolling(2, win_type="gaussian").sum(std=3)
        0         NaN
        1    0.986207
        2    5.917243
        3    6.903450
        4    9.862071
        dtype: float64
        Úsum©r…   r†   )Úwindow_aggregationsÚroll_weighted_sumr"  ©r`   r†   r›   Úwindow_funcs       ra   r¥  z
Window.sum  s=   € ôf *×;Ñ;ˆð ˆt�{‰{Øð
àØ%ñ
ð ñ	
ð 	
rc   c                óN   — t         j                  } | j                  |fd|dœ|¤ŽS )ai  
        Calculate the rolling weighted window mean.

        The window type is determined by the ``win_type`` parameter specified
        in :meth:`DataFrame.rolling` or :meth:`Series.rolling`. Additional
        keyword arguments are passed to the SciPy window function.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

        **kwargs
            Keyword arguments to configure the ``SciPy`` weighted window type.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.mean : Aggregating mean for Series.
        DataFrame.mean : Aggregating mean for DataFrame.

        Examples
        --------
        >>> ser = pd.Series([0, 1, 5, 2, 8])

        To get an instance of :class:`~pandas.core.window.rolling.Window` we need
        to pass the parameter `win_type`.

        >>> type(ser.rolling(2, win_type="gaussian"))
        <class 'pandas.api.typing.Window'>

        In order to use the `SciPy` Gaussian window we need to provide the parameters
        `M` and `std`. The parameter `M` corresponds to 2 in our example.
        We pass the second parameter `std` as a parameter of the following method:

        >>> ser.rolling(2, win_type="gaussian").mean(std=3)
        0    NaN
        1    0.5
        2    3.0
        3    3.5
        4    5.0
        dtype: float64
        Úmeanr¦  )r§  Úroll_weighted_meanr"  r©  s       ra   r¬  zWindow.meanY  s=   € ôd *×<Ñ<ˆð ˆt�{‰{Øð
àØ%ñ
ð ñ	
ð 	
rc   c                óˆ   — t        t        j                  |¬«      }|j                  dd«        | j                  |fd|dœ|¤ŽS )a  
        Calculate the rolling weighted window variance.

        The window type is determined by the ``win_type`` parameter specified
        in :meth:`DataFrame.rolling` or :meth:`Series.rolling`. Additional
        keyword arguments are passed to the SciPy window function.

        Parameters
        ----------
        ddof : int, default 1
            Delta Degrees of Freedom.  The divisor used in calculations
            is ``N - ddof``, where ``N`` represents the number of elements.
        numeric_only : bool, default False
            Include only float, int, boolean columns.

        **kwargs
            Keyword arguments to configure the ``SciPy`` weighted window type.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.var : Aggregating var for Series.
        DataFrame.var : Aggregating var for DataFrame.

        Examples
        --------
        >>> ser = pd.Series([0, 1, 5, 2, 8])

        To get an instance of :class:`~pandas.core.window.rolling.Window` we need
        to pass the parameter `win_type`.

        >>> type(ser.rolling(2, win_type="gaussian"))
        <class 'pandas.api.typing.Window'>

        In order to use the `SciPy` Gaussian window we need to provide the parameters
        `M` and `std`. The parameter `M` corresponds to 2 in our example.
        We pass the second parameter `std` as a parameter of the following method:

        >>> ser.rolling(2, win_type="gaussian").var(std=3)
        0     NaN
        1     0.5
        2     8.0
        3     4.5
        4    18.0
        dtype: float64
        ©Úddofr…   NÚvarr¦  )r   r§  Úroll_weighted_varÚpopr"  )r`   r°  r†   r›   rª  s        ra   r±  z
Window.var–  sD   € ôj Ô1×CÑCÈ$ÔOˆØ�
‰
�6˜4Ô Øˆt�{‰{˜;ÐX¨UÀÑXÐQWÑXÐXrc   c           	     ó@   — t         | j                  d|d|dœ|¤Ž«      S )a=  
        Calculate the rolling weighted window standard deviation.

        The window type is determined by the ``win_type`` parameter specified
        in :meth:`DataFrame.rolling` or :meth:`Series.rolling`. Additional
        keyword arguments are passed to the SciPy window function.

        Parameters
        ----------
        ddof : int, default 1
            Delta Degrees of Freedom.  The divisor used in calculations
            is ``N - ddof``, where ``N`` represents the number of elements.
        numeric_only : bool, default False
            Include only float, int, boolean columns.

        **kwargs
            Keyword arguments to configure the ``SciPy`` weighted window type.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.std : Aggregating std for Series.
        DataFrame.std : Aggregating std for DataFrame.

        Examples
        --------
        >>> ser = pd.Series([0, 1, 5, 2, 8])

        To get an instance of :class:`~pandas.core.window.rolling.Window` we need
        to pass the parameter `win_type`.

        >>> type(ser.rolling(2, win_type="gaussian"))
        <class 'pandas.api.typing.Window'>

        In order to use the `SciPy` Gaussian window we need to provide the parameters
        `M` and `std`. The parameter `M` corresponds to 2 in our example.
        We pass the second parameter `std` as a parameter of the following method:

        >>> ser.rolling(2, win_type="gaussian").std(std=3)
        0         NaN
        1    0.707107
        2    2.828427
        3    2.121320
        4    4.242641
        dtype: float64
        Ústd)r°  r…   r†   rF  )r2   r±  )r`   r°  r†   r›   s       ra   rµ  z
Window.stdÏ  s,   € ôj ØˆD�H‰HÐP˜$ U¸ÑPÈÑPó
ð 	
rc   r>  )r}   r!  rš  rô   r<  r!  rE  )r  z,Callable[[np.ndarray, int, int], np.ndarray]r…   r;  r†   r  r  rH  r¦   r?  ©r†   r  ©rv   F©r°  rô   r†   r  )rr   rJ  rK  rL  rK   r_   rœ  r"  r7  r3  r¥  r¬  r±  rµ  rŽ  r�  s   @ra   r‘  r‘  b  s{   ø„ ñ|ò|	€KõUó,ð #Ø&(ð<
à:ð<
ð ð<
ð ð	<
ð
 $ó<
ó|Mð^ €Cô<
ô|;
ôz7Y÷r7
ð 7
rc   r‘  c                  ó2  — e Zd Zddd„Z	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 dd„Z	 	 	 	 	 	 	 	 	 	 dd„Ze	 	 	 	 	 	 	 	 dd„«       Ze	 	 	 	 	 	 	 	 dd„«       Z	 	 	 	 	 	 	 	 d d„Z	 	 	 d!	 	 	 	 	 d"d„Z	 	 	 d!	 	 	 	 	 d"d	„Z		 	 	 d!	 	 	 	 	 d"d
„Z
	 	 	 d!	 	 	 	 	 d"d„Z	 	 	 d!	 	 	 	 	 d"d„Z	 	 	 	 d#	 	 	 	 	 	 	 d$d„Z	 	 	 	 d#	 	 	 	 	 	 	 d$d„Zddd„Zd%d&d„Zddd„Zddd„Zddd„Z	 	 d'	 	 	 	 	 d(d„Z	 	 	 	 d)	 	 	 	 	 	 	 d*d„Z	 d	 dd„Z	 	 	 	 d+	 	 	 	 	 	 	 d,d„Z	 	 	 	 d+	 	 	 	 	 	 	 d,d„Zy)-ÚRollingAndExpandingMixinc                óJ   — t         j                  }| j                  |d|¬«      S )Nrò   r¦  )r§  Úroll_sumr"  ©r`   r†   rª  s      ra   rò   zRollingAndExpandingMixin.count
  s"   € Ü)×2Ñ2ˆØ�{‰{˜;¨WÀ<ˆ{ÓPÐPrc   Nc                óš  — |€d}|€i }t        |«      st        d«      ‚d}t        |«      r\|du rt        d«      ‚t        |||d¬«      \  }}| j                  dk(  rt        |fi t        |«      ¤Ž}nGt        |fi t        |«      ¤Ž}n1|dv r"|�t        d	«      ‚| j                  ||||«      }nt        d
«      ‚| j                  |d|¬«      S )NrF  z'raw parameter must be `True` or `False`Fz.raw must be `True` when using the numba enginerv   )Únum_required_argsrj   )ÚcythonNz+cython engine does not accept engine_kwargsz)engine must be either 'numba' or 'cython'r4  )r…   r  )
r   r]   r/   r0   rX   r4   r.   r5   Ú_generate_cython_apply_funcr"  )	r`   r  r2  Úenginer*  r1  r›   r  Ú
apply_funcs	            ra   r4  zRollingAndExpandingMixin.apply  s  € ð ˆ<ØˆDØˆ>ØˆFä�sŒ|ÜÐFÓGÐGà&(ˆ
Ü˜6Ô"Ø�e‰|Ü Ð!QÓRÐRÜ!;Ø�d˜F°aô"ÑˆJ˜ð �{‰{˜hÒ&Ü6ØñÜ-¨mÓ<ñ‘
ô 7ØñÜ-¨mÓ<ñ‘
ð Ð'Ñ'ØÐ(Ü Ð!NÓOÐOØ×9Ñ9¸$ÀÈÈTÓR‰JäÐHÓIÐIà�{‰{ØØØ!ð ó 
ð 	
rc   c                óx   ‡ ‡‡— ddl mŠ t        t        j                  ||t        |«      |¬«      Š|fˆˆ ˆfd„	}|S )Nr   rÑ   )r1  r›   r2  Úfunctionc                óH   •— |s ‰| ‰j                   d¬«      }  ‰| |||«      S )NF)rZ   rÓ   )rM   )rÌ   Úbeginry   rU   r2  rC   r`   rª  s        €€€ra   rÃ  zHRollingAndExpandingMixin._generate_cython_apply_func.<locals>.apply_funcL  s)   ø€ Ùá ¨d¯h©h¸UÔC�Ù˜v u¨c°;Ó?Ð?rc   )rÔ   rC   r   r§  Ú
roll_applyr  )r`   r1  r›   r2  rÅ  rÃ  rC   rª  s   `     @@ra   rÁ  z4RollingAndExpandingMixin._generate_cython_apply_func;  s?   ú€ õ 	"äÜ×*Ñ*ØØÜ�S“	Øô
ˆð =@÷ 	@ð Ðrc   c                 ó   — y r¦   rF  ©r`   r  r1  r›   s       ra   ÚpipezRollingAndExpandingMixin.pipeT  ó   € ð rc   c                 ó   — y r¦   rF  rÊ  s       ra   rË  zRollingAndExpandingMixin.pipe\  rÌ  rc   c                ó6   — t        j                  | |g|¢­i |¤ŽS r¦   )rw  rË  rÊ  s       ra   rË  zRollingAndExpandingMixin.piped  s   € ô �x‰x˜˜dÐ4 TÒ4¨VÑ4Ð4rc   c                ó
  — t        |«      rU| j                  dk(  r.t        t        j                  «      }| j                  |d||¬«      S ddlm} | j                  ||«      S t        j                  }| j                  |d|¬«      S )Nri   T©r2  rÂ  r*  r   )Úsliding_sumr¥  r¦  )r/   rX   r3   rÆ   Únansumr4  Úpandas.core._numba.kernelsrÑ  r.  r§  r¼  r"  )r`   r†   rÂ  r*  r  rÑ  rª  s          ra   r¥  zRollingAndExpandingMixin.suml  s�   € ô ˜6Ô"Ø�{‰{˜gÒ%Ü>¼r¿y¹yÓI�Ø—z‘zØØØ!Ø"/ð	 "ó ð õ Cà×(Ñ(¨°mÓDÐDÜ)×2Ñ2ˆØ�{‰{˜;¨UÀˆ{ÓNÐNrc   c                ó  — t        |«      rW| j                  dk(  r.t        t        j                  «      }| j                  |d||¬«      S ddlm} | j                  ||d¬«      S t        j                  }| j                  |d|¬«      S )	Nri   TrÐ  r   ©Úsliding_min_max©Úis_maxÚmaxr¦  )r/   rX   r3   rÆ   Únanmaxr4  rÓ  rÖ  r.  r§  Úroll_maxr"  ©r`   r†   rÂ  r*  r  rÖ  rª  s          ra   rÙ  zRollingAndExpandingMixin.max‚  s‡   € ô ˜6Ô"Ø�{‰{˜gÒ%Ü>¼r¿y¹yÓI�Ø—z‘zØØØ!Ø"/ð	 "ó ð õ Gà×(Ñ(¨¸-ÐPTÐ(ÓUÐUÜ)×2Ñ2ˆØ�{‰{˜;¨UÀˆ{ÓNÐNrc   c                ó  — t        |«      rW| j                  dk(  r.t        t        j                  «      }| j                  |d||¬«      S ddlm} | j                  ||d¬«      S t        j                  }| j                  |d|¬	«      S )
Nri   TrÐ  r   rÕ  Fr×  Úminr¦  )r/   rX   r3   rÆ   Únanminr4  rÓ  rÖ  r.  r§  Úroll_minr"  rÜ  s          ra   rÞ  zRollingAndExpandingMixin.min˜  s‡   € ô ˜6Ô"Ø�{‰{˜gÒ%Ü>¼r¿y¹yÓI�Ø—z‘zØØØ!Ø"/ð	 "ó ð õ Gà×(Ñ(¨¸-ÐPUÐ(ÓVÐVÜ)×2Ñ2ˆØ�{‰{˜;¨UÀˆ{ÓNÐNrc   c                ó
  — t        |«      rU| j                  dk(  r.t        t        j                  «      }| j                  |d||¬«      S ddlm} | j                  ||«      S t        j                  }| j                  |d|¬«      S )Nri   TrÐ  r   )Úsliding_meanr¬  r¦  )r/   rX   r3   rÆ   Únanmeanr4  rÓ  râ  r.  r§  Ú	roll_meanr"  )r`   r†   rÂ  r*  r  râ  rª  s          ra   r¬  zRollingAndExpandingMixin.mean®  s�   € ô ˜6Ô"Ø�{‰{˜gÒ%Ü>¼r¿z¹zÓJ�Ø—z‘zØØØ!Ø"/ð	 "ó ð õ Dà×(Ñ(¨°}ÓEÐEÜ)×3Ñ3ˆØ�{‰{˜;¨VÀ,ˆ{ÓOÐOrc   c                óü   — t        |«      rN| j                  dk(  rt        t        j                  «      }nt        j                  }| j                  |d||¬«      S t        j                  }| j                  |d|¬«      S )Nri   TrÐ  Úmedianr¦  )	r/   rX   r3   rÆ   Ú	nanmedianr4  r§  Úroll_median_cr"  )r`   r†   rÂ  r*  r  rª  s         ra   ræ  zRollingAndExpandingMixin.medianÄ  ss   € ô ˜6Ô"Ø�{‰{˜gÒ%Ü>¼r¿|¹|ÓL‘ä—|‘|�à—:‘:ØØØØ+ð	 ó ð ô *×7Ñ7ˆØ�{‰{˜;¨XÀLˆ{ÓQÐQrc   c                óê   ‡‡— t        |«      r=| j                  dk(  rt        d«      ‚ddlm} t        | j                  ||‰¬«      «      S t        j                  Šˆˆfd„}| j                  |d|¬«      S )	Nri   z%std not supported with method='table'r   ©Úsliding_varr¯  c           	     ó0   •— t         ‰| |||‰¬«      «      S )Nr¯  )r2   )rÌ   rÇ  ry   rU   r°  rª  s       €€ra   Ú
zsqrt_funcz0RollingAndExpandingMixin.std.<locals>.zsqrt_funcè  s   ø€ Ü™ V¨U°C¸È4ÔPÓQÐQrc   rµ  r¦  )
r/   rX   r„   rÓ  rë  r2   r.  r§  Úroll_varr"  )r`   r°  r†   rÂ  r*  rë  rí  rª  s    `     @ra   rµ  zRollingAndExpandingMixin.stdÙ  sw   ù€ ô ˜6Ô"Ø�{‰{˜gÒ%Ü)Ð*QÓRÐRÝ>ä˜×*Ñ*¨;¸ÈDÐ*ÓQÓRÐRÜ)×2Ñ2ˆõ	Rð �{‰{ØØØ%ð ó 
ð 	
rc   c                óÞ   — t        |«      r4| j                  dk(  rt        d«      ‚ddlm} | j                  |||¬«      S t        t        j                  |¬«      }| j                  |d|¬«      S )Nri   z%var not supported with method='table'r   rê  r¯  r±  r¦  )
r/   rX   r„   rÓ  rë  r.  r   r§  rî  r"  )r`   r°  r†   rÂ  r*  rë  rª  s          ra   r±  zRollingAndExpandingMixin.varñ  sq   € ô ˜6Ô"Ø�{‰{˜gÒ%Ü)Ð*QÓRÐRÝ>à×$Ñ$ [°-ÀdÐ$ÓKÐKÜÔ1×:Ñ:ÀÔFˆØ�{‰{ØØØ%ð ó 
ð 	
rc   c                óJ   — t         j                  }| j                  |d|¬«      S )NÚskewr¦  )r§  Ú	roll_skewr"  r½  s      ra   rñ  zRollingAndExpandingMixin.skew  ó,   € Ü)×3Ñ3ˆØ�{‰{ØØØ%ð ó 
ð 	
rc   c                ó�   — | j                  d|«       | j                  ||¬«      | j                  |¬«      j                  d«      z  S )NÚsem©r†   r°  ©r†   ç      à?©r‡   rµ  rò   Úpow©r`   r°  r†   s      ra   rõ  zRollingAndExpandingMixin.sem  sC   € à×#Ñ# E¨<Ô8Ø�x‰x \¸ˆxÓ=Ø�J‰J LˆJÓ1ß
‰#ˆc‹(ñð 	rc   c                óJ   — t         j                  }| j                  |d|¬«      S )NÚkurtr¦  )r§  Ú	roll_kurtr"  r½  s      ra   rý  zRollingAndExpandingMixin.kurt  ró  rc   c                óJ   — t         j                  }| j                  |d|¬«      S )NÚfirstr¦  )r§  Ú
roll_firstr"  r½  s      ra   r   zRollingAndExpandingMixin.first  s,   € Ü)×4Ñ4ˆØ�{‰{ØØØ%ð ó 
ð 	
rc   c                óJ   — t         j                  }| j                  |d|¬«      S )NÚlastr¦  )r§  Ú	roll_lastr"  r½  s      ra   r  zRollingAndExpandingMixin.last$  ró  rc   c                óº   — |dk(  rt         j                  }n2|dk(  rt         j                  }nt        t         j                  ||¬«      }| j                  |d|¬«      S )Ng      ð?g        )ÚquantileÚinterpolationr  r¦  )r§  rÛ  rà  r   Úroll_quantiler"  )r`   Úqr  r†   rª  s        ra   r  z!RollingAndExpandingMixin.quantile,  sX   € ð �Š8Ü-×6Ñ6‰KØ�#ŠXÜ-×6Ñ6‰Kä!Ü#×1Ñ1ØØ+ôˆKð �{‰{˜;¨ZÀlˆ{ÓSÐSrc   c                ód   — t        t        j                  |||¬«      }| j                  |d|¬«      S )N)rX   Ú	ascendingÚ
percentileÚrankr¦  )r   r§  Ú	roll_rankr"  )r`   rX   r  Úpctr†   rª  s         ra   r  zRollingAndExpandingMixin.rank?  s7   € ô Ü×)Ñ)ØØØô	
ˆð �{‰{˜;¨VÀ,ˆ{ÓOÐOrc   c                ó\   — t        t        j                  «      }| j                  |d|¬«      S )NÚnuniquer¦  )r   r§  Úroll_nuniquer"  r½  s      ra   r  z RollingAndExpandingMixin.nuniqueO  s.   € ô Ü×,Ñ,ó
ˆð �{‰{˜;¨YÀ\ˆ{ÓRÐRrc   c                ó²   ‡ ‡‡— ‰ j                   �t        d«      ‚‰ j                  d|«       ddlmŠ ˆˆˆ fd„}‰ j                  ‰ j                  ||||«      S )Nzstep not implemented for covÚcovr   rÑ   c                óÜ  •— ‰j                  | «      }‰j                  |«      }‰j                  «       }‰j                  �‰j                  n|j                  }|j	                  t        |«      |‰j                  ‰j                  ‰j                  ¬«      \  }}‰j                  ||t        |«      «       t        j                  |||||‰
«      } ‰	|| j                  | j                  d¬«      S ©Nr·   FrÒ   )rÏ   r»   rU   rð   ro   rw   rV   rR   rS   r{   r§  Úroll_covrZ   r…   )r  ÚyÚx_arrayÚy_arrayr  rU   rx   ry   r}   rC   r°  r`   s            €€€ra   Úcov_funcz.RollingAndExpandingMixin.cov.<locals>.cov_funcf  sâ   ø€ Ø×'Ñ'¨Ó*ˆGØ×'Ñ'¨Ó*ˆGØ!×5Ñ5Ó7ˆNð ×#Ñ#Ð/ð × Ò à#×/Ñ/ð ð
 (×9Ñ9Ü˜w›<Ø'Ø—{‘{Ø—{‘{Ø—Y‘Yð :ó ‰JˆE�3ð ×%Ñ% e¨S´#°g³,Ô?ä(×1Ñ1Ø˜ %¨¨k¸4óˆFñ ˜&¨¯©°a·f±fÀ5ÔIÐIrc   ©rS   r„   r‡   rÔ   rC   r  r�   )r`   r  r  r°  r†   r  rC   s   `  `  @ra   r  zRollingAndExpandingMixin.covY  sZ   ú€ ð �9‰9Ð Ü%Ð&DÓEÐEØ×#Ñ# E¨<Ô8å!ö	Jð. ×#Ñ#Ø×Ñ  x°¸<ó
ð 	
rc   c                ó®   ‡ ‡— ‰ j                   �t        d«      ‚‰ j                  d|«       ddlmŠ ˆˆ fd„}‰ j                  ‰ j                  ||||«      S )Nzstep not implemented for corrÚcorrr   rÑ   c                óÚ  •— ‰
j                  | «      }‰
j                  |«      }‰
j                  «       }‰
j                  �‰
j                  n|j                  }|j	                  t        |«      |‰
j                  ‰
j                  ‰
j                  ¬«      \  }}‰
j                  ||t        |«      «       t        j                  |||||«      } ‰	|| j                  | j                  d¬«      S r  )rÏ   r»   rU   rð   ro   rw   rV   rR   rS   r{   r§  Ú	roll_corrrZ   r…   )r  r  r  r  r  rU   rx   ry   r}   rC   r`   s            €€ra   Ú	corr_funcz0RollingAndExpandingMixin.corr.<locals>.corr_funcŽ  sà   ø€ Ø×'Ñ'¨Ó*ˆGØ×'Ñ'¨Ó*ˆGØ!×5Ñ5Ó7ˆNð ×#Ñ#Ð/ð × Ò à#×/Ñ/ð ð
 (×9Ñ9Ü˜w›<Ø'Ø—{‘{Ø—{‘{Ø—Y‘Yð :ó ‰JˆE�3ð ×%Ñ% e¨S´#°g³,Ô?ä(×2Ñ2Ø˜ %¨¨kóˆFñ ˜&¨¯©°a·f±fÀ5ÔIÐIrc   r  )r`   r  r  r°  r†   r!  rC   s   `     @ra   r  zRollingAndExpandingMixin.corr�  sZ   ù€ ð �9‰9Ð Ü%Ð&EÓFÐFØ×#Ñ# F¨LÔ9å!õ	Jð. ×#Ñ#Ø×Ñ  x°¸Ló
ð 	
rc   r?  r¶  ©FNNNN©r  rG  r2  r  rÂ  ú!Literal['cython', 'numba'] | Noner*  rI  r1  ztuple[Any, ...] | Noner›   zdict[str, Any] | None)
r1  rH  r›   zdict[str, Any]r2  zbool | np.bool_rÅ  rG  r<  z?Callable[[np.ndarray, np.ndarray, np.ndarray, int], np.ndarray]©r  z!Callable[Concatenate[Self, P], T]r1  zP.argsr›   zP.kwargsr<  r?   ©r  ztuple[Callable[..., T], str]r1  r   r›   r   r<  r?   ©r  z@Callable[Concatenate[Self, P], T] | tuple[Callable[..., T], str]r1  r   r›   r   r<  r?   ©FNN©r†   r  rÂ  r$  r*  rI  ©rv   FNN©r°  rô   r†   r  rÂ  r$  r*  rI  r·  r¸  ©ÚlinearF©r	  Úfloatr  r<   r†   r  ©ÚaverageTFF©rX   r@   r  r  r  r  r†   r  ©NNrv   F©r  rD  r  r9  r°  rô   r†   r  )rr   rJ  rK  rò   r4  rÁ  r   rË  r¥  rÙ  rÞ  r¬  ræ  rµ  r±  rñ  rõ  rý  r   r  r  r  r  r  r  rF  rc   ra   rº  rº  	  s›  „ ôQð Ø48Ø04Ø'+Ø(,ð+
à ð+
ð ð+
ð 2ð	+
ð
 .ð+
ð %ð+
ð &ó+
ðZàðð ðð ð	ð
 %ðð 
Ióð2 ðà/ðð ðð ð	ð
 
òó ðð ðà*ðð ðð ð	ð
 
òó ðð5àNð5ð ð5ð ð	5ð
 
ó5ð #Ø48Ø04ð	OàðOð 2ðOð .ó	Oð0 #Ø48Ø04ð	OàðOð 2ðOð .ó	Oð0 #Ø48Ø04ð	OàðOð 2ðOð .ó	Oð0 #Ø48Ø04ð	PàðPð 2ðPð .ó	Pð0 #Ø48Ø04ð	RàðRð 2ðRð .ó	Rð. Ø"Ø48Ø04ð
àð
ð ð
ð 2ð	
ð
 .ó
ð4 Ø"Ø48Ø04ð
àð
ð ð
ð 2ð	
ð
 .ó
ô(
ôô
ô
ô
ð 08Ø"ð	TàðTð -ðTð ó	Tð* %.ØØØ"ðPà!ðPð ðPð ð	Pð
 óPð$ #ðSàóSð ,0Ø $ØØ"ð&
à(ð&
ð ð&
ð ð	&
ð
 ó&
ðT ,0Ø $ØØ"ð&
à(ð&
ð ð&
ð ð	&
ð
 ô&
rc   rº  c                  ó¸  ‡ — e Zd ZU g d¢Zded<   d ˆ fd„Zd d„Zd!d„Zd"ˆ fd„	ZeZ	d#d$ˆ fd	„Z
	 	 	 	 	 d%	 	 	 	 	 	 	 	 	 	 	 d&ˆ fd
„Ze	 	 	 	 	 	 	 	 d'd„«       Ze	 	 	 	 	 	 	 	 d(d„«       Ze	 	 	 	 	 	 	 	 d)ˆ fd„«       Z	 	 	 d*	 	 	 	 	 d+ˆ fd„Z	 d#dddœ	 	 	 	 	 d+ˆ fd„Z	 	 	 d*	 	 	 	 	 d+ˆ fd„Z	 	 	 d*	 	 	 	 	 d+ˆ fd„Z	 	 	 d*	 	 	 	 	 d+ˆ fd„Z	 	 	 	 d,	 	 	 	 	 	 	 d-ˆ fd„Z	 	 	 	 d,	 	 	 	 	 	 	 d-ˆ fd„Zd#d$ˆ fd„Zd.d/d„Zd#d$ˆ fd„Zd#d$ˆ fd„Zd#d$ˆ fd„Z	 	 d0	 	 	 	 	 d1ˆ fd„Z	 	 	 	 d2	 	 	 	 	 	 	 d3ˆ fd„Z	 d#	 d$ˆ fd„Z	 	 	 	 d4	 	 	 	 	 	 	 d5ˆ fd„Z	 	 	 	 d4	 	 	 	 	 	 	 d5ˆ fd„Zˆ xZ S )6ÚRollingr’  rJ   rK   c                óÈ  •— t         ‰| �  «        | j                  j                  smt	        | j
                  t        t        t        f«      sHt	        | j
                  j                  t        «      �rg| j
                  j                  j                  dv �rDt	        | j                  t        t        t        f«      �r| j!                  «        	 t#        | j                  «      }t	        | j
                  t        «      rT|j(                  | j
                  j*                  j(                  | j
                  j*                  j,                  z  z  | _        n_	 t1        | j
                  j                  «      }t3        d|«      }t5        |j(                  «      j7                  |«      j8                  | _        | j:                  €d| _        | j<                  �t?        d«      ‚y t	        | j                  t@        «      ry tC        | j                  «      r| j                  dk  rt'        d	«      ‚y # t$        t&        f$ r}t'        d| j                  › d�«      |‚d }~ww xY w# t$        $ r d}Y Œów xY w)
Nrâ   zpassed window z, is not compatible with a datetimelike indexÚnsr>   rv   z,step is not supported with frequency windowsr   r•  )"rZ  r_   rP   rŠ  r[   rM   r(   r,   r+   rƒ   r   rå   rT   r;  r   r   Ú _validate_datetimelike_monotonicr   rk   r]   ÚnanosÚfreqÚnrY   rG   r   r   Úas_unitÚ_valuerU   rS   r„   r$   r   )r`   r;  rÍ   Úunitr[  s       €ra   r_   zRolling._validate·  sÛ  ø€ Ü‰ÑÔð �H‰H�NŠNÜ˜$Ÿ(™(¤]´NÄKÐ$PÔQÜ˜4Ÿ8™8Ÿ>™>¬:Õ6¸4¿8¹8¿>¹>×;NÑ;NÐRVÒ;VÜ˜Ÿ™¤s¬J¼	Ð&BÕCØ×1Ñ1Ô3ðÜ  §¡Ó-�ô ˜$Ÿ(™(¤KÔ0ð %)§J¡JØ—H‘H—M‘M×'Ñ'¨$¯(©(¯-©-¯/©/Ñ9ñ%�Õ!ð Ü(¨¯©¯©Ó8�Dô ˜J¨Ó-�Ü$-¨d¯j©jÓ$9×$AÑ$AÀ$Ó$G×$NÑ$N�Ô!ð ×ÑÐ'Ø#$�Ô à�y‰yÐ$Ü)ØBóð ð %ô
 ˜Ÿ™¤[Ô1àÜ˜DŸK™KÔ(¨D¯K©K¸!ªOÜÐEÓFÐFð -<øôA œzÐ*ò Ü Ø$ T§[¡[ Mð 2;ð ;óð ðûðûô !ò  à’Dð ús*   Ã
H" ÅI È"IÈ1IÉIÉI!É I!c                óÐ   — | j                   j                  r| j                  d«       | j                   j                  s)| j                   j                  s| j                  d«       yyy)z€
        Validate self._on is monotonic (increasing or decreasing) and has
        no NaT values for frequency windows.
        úvalues must not have NaTzvalues must be monotonicN)rM   ÚhasnansÚ_raise_monotonic_errorÚis_monotonic_increasingÚis_monotonic_decreasingr¨   s    ra   r9  z(Rolling._validate_datetimelike_monotonicè  sQ   € ð
 �8‰8×ÒØ×'Ñ'Ð(BÔCØ—‘×0Ò0°D·H±H×4TÒ4TØ×'Ñ'Ð(BÕCð 5UÐ0rc   c                óB   — | j                   }|€d}t        |› d|› �«      ‚)NrZ   ú )rQ   r]   )r`   ÚmsgrQ   s      ra   rC  zRolling._raise_monotonic_errorò  s*   € Ø�W‰WˆØˆ:ØˆBÜ˜B˜4˜q  ˜Ó'Ð'rc   Nc                ó*   •— t        ‰| �  |g|¢­i |¤ŽS )a¿
  
        Aggregate using one or more operations over the specified axis.

        This method allows combining multiple aggregation functions (e.g.
        ``'sum'``, ``'mean'``) in a single call, returning a result for each
        function applied to each rolling window.

        Parameters
        ----------
        func : function, str, list or dict
            Function to use for aggregating the data. If a function, must either
            work when passed a Series/Dataframe or
            when passed to Series/Dataframe.apply.

            Accepted combinations are:

            - function
            - string function name
            - list of functions and/or function names, e.g. ``[np.sum, 'mean']``
            - dict of axis labels -> functions, function names or list of such.

        *args
            Positional arguments to pass to `func`.
        **kwargs
            Keyword arguments to pass to `func`.

        Returns
        -------
        scalar, Series or DataFrame

            The return can be:

            * scalar : when Series.agg is called with single function
            * Series : when DataFrame.agg is called with a single function
            * DataFrame : when DataFrame.agg is called with several functions

        See Also
        --------
        Series.rolling : Calling object with Series data.
        DataFrame.rolling : Calling object with DataFrame data.

        Notes
        -----
        The aggregation operations are always performed over an axis, either the
        index (default) or the column axis. This behavior is different from
        `numpy` aggregation functions (`mean`, `median`, `prod`, `sum`, `std`,
        `var`), where the default is to compute the aggregation of the flattened
        array, e.g., ``numpy.mean(arr_2d)`` as opposed to
        ``numpy.mean(arr_2d, axis=0)``.

        `agg` is an alias for `aggregate`. Use the alias.

        Functions that mutate the passed object can produce unexpected
        behavior or errors and are not supported. See :ref:`gotchas.udf-mutation`
        for more details.

        A passed user-defined-function will be passed a Series for evaluation.

        If ``func`` defines an index relabeling, ``axis`` must be ``0`` or ``index``.

        Examples
        --------
        >>> df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6], "C": [7, 8, 9]})
        >>> df
        A  B  C
        0  1  4  7
        1  2  5  8
        2  3  6  9

        >>> df.rolling(2).sum()
            A     B     C
        0  NaN   NaN   NaN
        1  3.0   9.0  15.0
        2  5.0  11.0  17.0

        >>> df.rolling(2).agg({"A": "sum", "B": "min"})
            A    B
        0  NaN  NaN
        1  3.0  4.0
        2  5.0  5.0
        )rZ  r7  ©r`   r  r1  r›   r[  s       €ra   r7  zRolling.aggregateø  s    ø€ ôd ‰wÑ  Ð7¨Ò7°Ñ7Ð7rc   c                ó"   •— t         ‰| �  |«      S )a²  
        Calculate the rolling count of non NaN observations.

        This is useful for identifying windows with missing data, as it counts
        only non-NaN entries within each window.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.count : Aggregating count for Series.
        DataFrame.count : Aggregating count for DataFrame.

        Examples
        --------
        >>> s = pd.Series([2, 3, np.nan, 10])
        >>> s.rolling(2).count()
        0    NaN
        1    2.0
        2    1.0
        3    1.0
        dtype: float64
        >>> s.rolling(3).count()
        0    NaN
        1    NaN
        2    2.0
        3    2.0
        dtype: float64
        >>> s.rolling(4).count()
        0    NaN
        1    NaN
        2    NaN
        3    3.0
        dtype: float64
        )rZ  rò   ©r`   r†   r[  s     €ra   rò   zRolling.countN  s   ø€ ô\ ‰w‰}˜\Ó*Ð*rc   c                ó.   •— t         ‰| �  ||||||¬«      S )a  
        Calculate the rolling custom aggregation function.

        Applies an arbitrary function to each rolling window. This is useful
        when the built-in rolling methods do not cover the desired computation.

        Parameters
        ----------
        func : function
            Must produce a single value from an ndarray input if ``raw=True``
            or a single value from a Series if ``raw=False``. Can also accept a
            Numba JIT function with ``engine='numba'`` specified.

        raw : bool, default False
            * ``False`` : passes each row or column as a Series to the
              function.
            * ``True`` : the passed function will receive ndarray
              objects instead. Pandas-only attributes such as ``.iloc``
              or ``.index`` are not available on ndarrays and will raise
              ``AttributeError`` if used inside ``func``.

            If you are just applying a NumPy reduction function this will
            achieve much better performance.

        engine : str, default None
            * ``'cython'`` : Runs rolling apply through C-extensions from cython.
            * ``'numba'`` : Runs rolling apply through JIT compiled code from numba.
              Only available when ``raw`` is set to ``True``.
            * ``None`` : Defaults to ``'cython'`` or
              globally setting ``compute.use_numba``.

        engine_kwargs : dict, default None
            * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
            * For ``'numba'`` engine, the engine can accept  ``nogil``
              and ``parallel`` dictionary keys. The values must either be ``True`` or
              ``False``.

            The default ``engine_kwargs`` for the ``'numba'`` engine is
            ``{'nogil': False, 'parallel': False}`` and will be
            applied to both the ``func`` and the ``apply`` rolling aggregation.

        args : tuple, default None
            Positional arguments to be passed into func.

        kwargs : dict, default None
            Keyword arguments to be passed into func.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.apply : Aggregating apply for Series.
        DataFrame.apply : Aggregating apply for DataFrame.

        Notes
        -----
        When ``raw=False``, the :class:`Series` passed to ``func`` is indexed by the
        column or :class:`Index` used to compute the rolling window. If
        :meth:`DataFrame.rolling` was called with ``on=col``, the index of the
        passed :class:`Series` will be the values of ``col`` rather than the
        original :class:`DataFrame` index. When ``on`` is not specified, the
        index of the passed :class:`Series` is the original index of the input.

        Examples
        --------
        >>> ser = pd.Series([1, 6, 5, 4])
        >>> ser.rolling(2).apply(lambda s: s.sum() - s.min())
        0    NaN
        1    6.0
        2    6.0
        3    5.0
        dtype: float64

        By default ``func`` is applied to each column independently. Use
        ``method="table"`` (which requires ``engine="numba"`` and ``raw=True``) to
        instead pass the whole :class:`DataFrame` window to ``func`` as a single 2D
        ndarray, so the function can combine multiple columns. Here a rolling dot
        product of columns ``A`` and ``B`` is computed; the scalar result is
        broadcast across the columns.

        >>> df = pd.DataFrame({"A": [1, 2, 3, 4, 5], "B": [5, 4, 3, 2, 1]})
        >>> def dot(window):
        ...     return (window[:, 0] * window[:, 1]).sum()
        >>> df.rolling(3, method="table").apply(
        ...     dot, engine="numba", raw=True
        ... )  # doctest: +SKIP
              A     B
        0   NaN   NaN
        1   NaN   NaN
        2  22.0  22.0
        3  25.0  25.0
        4  22.0  22.0
        )r2  rÂ  r*  r1  r›   )rZ  r4  )r`   r  r2  rÂ  r*  r1  r›   r[  s          €ra   r4  zRolling.apply~  s.   ø€ ôV ‰w‰}ØØØØ'ØØð ó 
ð 	
rc   c                 ó   — y r¦   rF  rÊ  s       ra   rË  zRolling.pipeò  rÌ  rc   c                 ó   — y r¦   rF  rÊ  s       ra   rË  zRolling.pipeú  rÌ  rc   c                ó*   •— t        ‰| �  |g|¢­i |¤ŽS )aÚ	  
        Apply a ``func`` with arguments to this Rolling object and return its result.

        Use `.pipe` when you want to improve readability by chaining together
        functions that expect
        Series, DataFrames, GroupBy, Rolling, Expanding or Resampler
        objects.
        Instead of writing

        >>> h = lambda x, arg2, arg3: x + 1 - arg2 * arg3
        >>> g = lambda x, arg1: x * 5 / arg1
        >>> f = lambda x: x**4
        >>> df = pd.DataFrame(
        ...     {"A": [1, 2, 3, 4]}, index=pd.date_range("2012-08-02", periods=4)
        ... )
        >>> h(g(f(df.rolling("2D")), arg1=1), arg2=2, arg3=3)  # doctest: +SKIP

        You can write

        >>> (
        ...     df.rolling("2D").pipe(f).pipe(g, arg1=1).pipe(h, arg2=2, arg3=3)
        ... )  # doctest: +SKIP

        which is much more readable.

        Parameters
        ----------
        func : callable or tuple of (callable, str)
            Function to apply to this Rolling object or, alternatively,
            a `(callable, data_keyword)` tuple where `data_keyword` is a
            string indicating the keyword of `callable` that expects the
            Rolling object.
        *args : iterable, optional
            Positional arguments passed into `func`.
        **kwargs : dict, optional
                A dictionary of keyword arguments passed into `func`.

        Returns
        -------
        Rolling
            The original object with the function `func` applied.

        See Also
        --------
        Series.pipe : Apply a function with arguments to a series.
        DataFrame.pipe: Apply a function with arguments to a dataframe.
        apply : Apply function to each group instead of to the
            full Rolling object.

        Notes
        -----
        See more `here
        <https://pandas.pydata.org/pandas-docs/stable/user_guide/groupby.html#piping-function-calls>`__.

        Examples
        --------

        >>> df = pd.DataFrame(
        ...     {"A": [1, 2, 3, 4]}, index=pd.date_range("2012-08-02", periods=4)
        ... )
        >>> df
                    A
        2012-08-02  1
        2012-08-03  2
        2012-08-04  3
        2012-08-05  4

        To get the difference between each rolling
        2-day window's maximum and minimum
        value in one pass, you can do

        >>> df.rolling("2D").pipe(lambda x: x.max() - x.min())
                    A
        2012-08-02  0.0
        2012-08-03  1.0
        2012-08-04  1.0
        2012-08-05  1.0
        )rZ  rË  rJ  s       €ra   rË  zRolling.pipe	  s   ø€ ôj ‰w‰|˜DÐ2 4Ò2¨6Ñ2Ð2rc   c                ó(   •— t         ‰| �  |||¬«      S )aå	  
        Calculate the rolling sum.

        This is equivalent to applying ``numpy.sum`` over each rolling window.
        Missing values (NaN) are excluded from the calculation.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

        engine : str, default None
            * ``'cython'`` : Runs the operation through C-extensions from cython.
            * ``'numba'`` : Runs the operation through JIT compiled code from numba.
            * ``None`` : Defaults to ``'cython'`` or
              globally setting ``compute.use_numba``

        engine_kwargs : dict, default None
            * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
            * For ``'numba'`` engine, the engine can accept  ``nogil``
              and ``parallel`` dictionary keys. The values must either be ``True`` or
              ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is
              ``{'nogil': False, 'parallel': False}``.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.sum : Aggregating sum for Series.
        DataFrame.sum : Aggregating sum for DataFrame.

        Notes
        -----
        See :ref:`window.numba_engine` and :ref:`enhancingperf.numba`
        for extended documentation and performance considerations
        for the Numba engine.

        Examples
        --------
        >>> s = pd.Series([1, 2, 3, 4, 5])
        >>> s
        0    1
        1    2
        2    3
        3    4
        4    5
        dtype: int64

        >>> s.rolling(3).sum()
        0     NaN
        1     NaN
        2     6.0
        3     9.0
        4    12.0
        dtype: float64

        >>> s.rolling(3, center=True).sum()
        0     NaN
        1     6.0
        2     9.0
        3    12.0
        4     NaN
        dtype: float64

        For DataFrame, each sum is computed column-wise.

        >>> df = pd.DataFrame({"A": s, "B": s**2})
        >>> df
        A   B
        0  1   1
        1  2   4
        2  3   9
        3  4  16
        4  5  25

        >>> df.rolling(3).sum()
             A     B
        0   NaN   NaN
        1   NaN   NaN
        2   6.0  14.0
        3   9.0  29.0
        4  12.0  50.0
        ©r†   rÂ  r*  )rZ  r¥  ©r`   r†   rÂ  r*  r[  s       €ra   r¥  zRolling.sumY	  s%   ø€ ô| ‰w‰{Ø%ØØ'ð ó 
ð 	
rc   )rÂ  r*  c               ó(   •— t         ‰| �  |||¬«      S )aÓ  
        Calculate the rolling maximum.

        This is equivalent to applying ``numpy.max`` over each rolling window.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

        *args : iterable, optional
            Positional arguments passed into ``func``.

        engine : str, default None
            * ``'cython'`` : Runs the operation through C-extensions from cython.
            * ``'numba'`` : Runs the operation through JIT compiled code from numba.
            * ``None`` : Defaults to ``'cython'`` or
              globally setting ``compute.use_numba``

        engine_kwargs : dict, default None
            * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
            * For ``'numba'`` engine, the engine can accept  ``nogil``
              and ``parallel`` dictionary keys. The values must either be ``True`` or
              ``False``.

            The default ``engine_kwargs`` for the ``'numba'`` engine is
            ``{'nogil': False, 'parallel': False}``.

        **kwargs : mapping, optional
            A dictionary of keyword arguments passed into ``func``.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.max : Aggregating max for Series.
        DataFrame.max : Aggregating max for DataFrame.

        Notes
        -----
        See :ref:`window.numba_engine` and :ref:`enhancingperf.numba`
        for extended documentation and performance considerations
        for the Numba engine.

        Examples
        --------
        >>> ser = pd.Series([1, 2, 3, 4])
        >>> ser.rolling(2).max()
        0    NaN
        1    2.0
        2    3.0
        3    4.0
        dtype: float64
        rR  )rZ  rÙ  )r`   r†   rÂ  r*  r1  r›   r[  s         €ra   rÙ  zRolling.max½	  s%   ø€ ôF ‰w‰{Ø%ØØ'ð ó 
ð 	
rc   c                ó(   •— t         ‰| �  |||¬«      S )a]  
        Calculate the rolling minimum.

        This is equivalent to applying ``numpy.min`` over each rolling window.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

        engine : str, default None
            * ``'cython'`` : Runs the operation through C-extensions from cython.
            * ``'numba'`` : Runs the operation through JIT compiled code from numba.
            * ``None`` : Defaults to ``'cython'`` or
              globally setting ``compute.use_numba``

        engine_kwargs : dict, default None
            * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
            * For ``'numba'`` engine, the engine can accept  ``nogil``
              and ``parallel`` dictionary keys. The values must either be ``True`` or
              ``False``.

            The default ``engine_kwargs`` for the ``'numba'`` engine is
            ``{'nogil': False, 'parallel': False}``.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.min : Aggregating min for Series.
        DataFrame.min : Aggregating min for DataFrame.

        Notes
        -----
        See :ref:`window.numba_engine` and :ref:`enhancingperf.numba`
        for extended documentation and performance considerations
        for the Numba engine.

        Examples
        --------
        Performing a rolling minimum with a window size of 3.

        >>> s = pd.Series([4, 3, 5, 2, 6])
        >>> s.rolling(3).min()
        0    NaN
        1    NaN
        2    3.0
        3    2.0
        4    2.0
        dtype: float64
        rR  )rZ  rÞ  rS  s       €ra   rÞ  zRolling.min
  s%   ø€ ô| ‰w‰{Ø%ØØ'ð ó 
ð 	
rc   c                ó(   •— t         ‰| �  |||¬«      S )a  
        Calculate the rolling mean.

        This is equivalent to applying ``numpy.mean`` over each rolling window.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

        engine : str, default None
            * ``'cython'`` : Runs the operation through C-extensions from cython.
            * ``'numba'`` : Runs the operation through JIT compiled code from numba.
            * ``None`` : Defaults to ``'cython'`` or
              globally setting ``compute.use_numba``

        engine_kwargs : dict, default None
            * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
            * For ``'numba'`` engine, the engine can accept  ``nogil``
              and ``parallel`` dictionary keys. The values must either be ``True`` or
              ``False``.

            The default ``engine_kwargs`` for the ``'numba'`` engine is
            ``{'nogil': False, 'parallel': False}``.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.mean : Aggregating mean for Series.
        DataFrame.mean : Aggregating mean for DataFrame.

        Notes
        -----
        See :ref:`window.numba_engine` and :ref:`enhancingperf.numba`
        for extended documentation and performance considerations
        for the Numba engine.

        Examples
        --------
        The below examples will show rolling mean calculations with window sizes of
        two and three, respectively.

        >>> s = pd.Series([1, 2, 3, 4])
        >>> s.rolling(2).mean()
        0    NaN
        1    1.5
        2    2.5
        3    3.5
        dtype: float64

        >>> s.rolling(3).mean()
        0    NaN
        1    NaN
        2    2.0
        3    3.0
        dtype: float64
        rR  )rZ  r¬  rS  s       €ra   r¬  zRolling.meanJ
  s%   ø€ ôJ ‰w‰|Ø%ØØ'ð ó 
ð 	
rc   c                ó(   •— t         ‰| �  |||¬«      S )a€  
        Calculate the rolling median.

        This is equivalent to applying ``numpy.median`` over each rolling
        window.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

        engine : str, default None
            * ``'cython'`` : Runs the operation through C-extensions from cython.
            * ``'numba'`` : Runs the operation through JIT compiled code from numba.
            * ``None`` : Defaults to ``'cython'`` or
              globally setting ``compute.use_numba``

        engine_kwargs : dict, default None
            * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
            * For ``'numba'`` engine, the engine can accept  ``nogil``
              and ``parallel`` dictionary keys. The values must either be ``True`` or
              ``False``.

            The default ``engine_kwargs`` for the ``'numba'`` engine is
            ``{'nogil': False, 'parallel': False}``.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.median : Aggregating median for Series.
        DataFrame.median : Aggregating median for DataFrame.

        Notes
        -----
        See :ref:`window.numba_engine` and :ref:`enhancingperf.numba`
        for extended documentation and performance considerations
        for the Numba engine.

        Examples
        --------
        Compute the rolling median of a series with a window size of 3.

        >>> s = pd.Series([0, 1, 2, 3, 4])
        >>> s.rolling(3).median()
        0    NaN
        1    NaN
        2    1.0
        3    2.0
        4    3.0
        dtype: float64
        rR  )rZ  ræ  rS  s       €ra   ræ  zRolling.median•
  s%   ø€ ô~ ‰w‰~Ø%ØØ'ð ó 
ð 	
rc   c                ó*   •— t         ‰| �  ||||¬«      S )a¯  
        Calculate the rolling standard deviation.

        This is equivalent to applying ``numpy.std`` (with the specified
        ``ddof``) over each rolling window.

        Parameters
        ----------
        ddof : int, default 1
            Delta Degrees of Freedom.  The divisor used in calculations
            is ``N - ddof``, where ``N`` represents the number of elements.

        numeric_only : bool, default False
            Include only float, int, boolean columns.

        engine : str, default None
            * ``'cython'`` : Runs the operation through C-extensions from cython.
            * ``'numba'`` : Runs the operation through JIT compiled code from numba.
            * ``None`` : Defaults to ``'cython'`` or
              globally setting ``compute.use_numba``

        engine_kwargs : dict, default None
            * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
            * For ``'numba'`` engine, the engine can accept  ``nogil``
              and ``parallel`` dictionary keys. The values must either be ``True`` or
              ``False``.

            The default ``engine_kwargs`` for the ``'numba'`` engine is
            ``{'nogil': False, 'parallel': False}``.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        numpy.std : Equivalent method for NumPy array.
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.std : Aggregating std for Series.
        DataFrame.std : Aggregating std for DataFrame.

        Notes
        -----
        The default ``ddof`` of 1 used in :meth:`Series.std` is different
        than the default ``ddof`` of 0 in :func:`numpy.std`.

        A minimum of one period is required for the rolling calculation.

        Examples
        --------
        >>> s = pd.Series([5, 5, 6, 7, 5, 5, 5])
        >>> s.rolling(3).std()
        0         NaN
        1         NaN
        2    0.577350
        3    1.000000
        4    1.000000
        5    1.154701
        6    0.000000
        dtype: float64
        ©r°  r†   rÂ  r*  )rZ  rµ  ©r`   r°  r†   rÂ  r*  r[  s        €ra   rµ  zRolling.stdÚ
  ó(   ø€ ôL ‰w‰{ØØ%ØØ'ð	 ó 
ð 	
rc   c                ó*   •— t         ‰| �  ||||¬«      S )a¥  
        Calculate the rolling variance.

        This is equivalent to applying ``numpy.var`` (with the specified
        ``ddof``) over each rolling window.

        Parameters
        ----------
        ddof : int, default 1
            Delta Degrees of Freedom.  The divisor used in calculations
            is ``N - ddof``, where ``N`` represents the number of elements.

        numeric_only : bool, default False
            Include only float, int, boolean columns.

        engine : str, default None
            * ``'cython'`` : Runs the operation through C-extensions from cython.
            * ``'numba'`` : Runs the operation through JIT compiled code from numba.
            * ``None`` : Defaults to ``'cython'`` or
              globally setting ``compute.use_numba``

        engine_kwargs : dict, default None
            * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
            * For ``'numba'`` engine, the engine can accept  ``nogil``
              and ``parallel`` dictionary keys. The values must either be ``True`` or
              ``False``.

            The default ``engine_kwargs`` for the ``'numba'`` engine is
            ``{'nogil': False, 'parallel': False}``.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        numpy.var : Equivalent method for NumPy array.
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.var : Aggregating var for Series.
        DataFrame.var : Aggregating var for DataFrame.

        Notes
        -----
        The default ``ddof`` of 1 used in :meth:`Series.var` is different
        than the default ``ddof`` of 0 in :func:`numpy.var`.

        A minimum of one period is required for the rolling calculation.

        Examples
        --------
        >>> s = pd.Series([5, 5, 6, 7, 5, 5, 5])
        >>> s.rolling(3).var()
        0         NaN
        1         NaN
        2    0.333333
        3    1.000000
        4    1.000000
        5    1.333333
        6    0.000000
        dtype: float64
        rY  )rZ  r±  rZ  s        €ra   r±  zRolling.var'  r[  rc   c                ó$   •— t         ‰| �  |¬«      S )a©  
        Calculate the rolling unbiased skewness.

        This is equivalent to applying ``scipy.stats.skew`` over each rolling
        window. A minimum of three periods is required.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        scipy.stats.skew : Third moment of a probability density.
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.skew : Aggregating skew for Series.
        DataFrame.skew : Aggregating skew for DataFrame.

        Notes
        -----

        A minimum of three periods is required for the rolling calculation.

        Examples
        --------
        >>> ser = pd.Series([1, 5, 2, 7, 15, 6])
        >>> ser.rolling(3).skew().round(6)
        0         NaN
        1         NaN
        2    1.293343
        3   -0.585583
        4    0.670284
        5    1.652317
        dtype: float64
        r÷  )rZ  rñ  rL  s     €ra   rñ  zRolling.skewt  s   ø€ ôT ‰w‰|¨ˆ|Ó6Ð6rc   c                óŽ   — | j                  d|«       | j                  ||¬«      | j                  |«      j                  d«      z  S )aÜ  
        Calculate the rolling standard error of mean.

        This is computed as the rolling standard deviation divided by the
        square root of the rolling count. A minimum of one period is required.

        Parameters
        ----------
        ddof : int, default 1
            Delta Degrees of Freedom.  The divisor used in calculations
            is ``N - ddof``, where ``N`` represents the number of elements.

        numeric_only : bool, default False
            Include only float, int, boolean columns.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.sem : Aggregating sem for Series.
        DataFrame.sem : Aggregating sem for DataFrame.

        Notes
        -----
        A minimum of one period is required for the calculation.

        Examples
        --------
        >>> s = pd.Series([0, 1, 2, 3])
        >>> s.rolling(2, min_periods=1).sem()
        0    NaN
        1    0.5
        2    0.5
        3    0.5
        dtype: float64
        rõ  rö  rø  rù  rû  s      ra   rõ  zRolling.sem   sD   € ðV 	×#Ñ# E¨<Ô8Ø�x‰x \¸ˆxÓ=Ø�J‰J�|Ó$ß
‰#ˆc‹(ñð 	rc   c                ó$   •— t         ‰| �  |¬«      S )a)  
        Calculate the rolling Fisher's definition of kurtosis without bias.

        This is equivalent to applying ``scipy.stats.kurtosis`` (with
        ``bias=False``) over each rolling window. A minimum of four periods
        is required.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        scipy.stats.kurtosis : Reference SciPy method.
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.kurt : Aggregating kurt for Series.
        DataFrame.kurt : Aggregating kurt for DataFrame.

        Notes
        -----
        A minimum of four periods is required for the calculation.

        Examples
        --------
        The example below will show a rolling calculation with a window size of
        four matching the equivalent function call using `scipy.stats`.

        >>> arr = [1, 2, 3, 4, 999]
        >>> import scipy.stats
        >>> print(f"{scipy.stats.kurtosis(arr[:-1], bias=False):.6f}")
        -1.200000
        >>> print(f"{scipy.stats.kurtosis(arr[1:], bias=False):.6f}")
        3.999946
        >>> s = pd.Series(arr)
        >>> s.rolling(4).kurt()
        0         NaN
        1         NaN
        2         NaN
        3   -1.200000
        4    3.999946
        dtype: float64
        r÷  )rZ  rý  rL  s     €ra   rý  zRolling.kurtÐ  s   ø€ ôd ‰w‰|¨ˆ|Ó6Ð6rc   c                ó$   •— t         ‰| �  |¬«      S )a÷  
        Calculate the rolling First (left-most) element of the window.

        Return the first observed value in each rolling window. This is useful
        for tracking the starting value of a window as it slides forward.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        GroupBy.first : Similar method for GroupBy objects.
        Rolling.last : Method to get the last element in each window.

        Examples
        --------
        The example below will show a rolling calculation with a window size of
        three.

        >>> s = pd.Series(range(5))
        >>> s.rolling(3).first()
        0         NaN
        1         NaN
        2         0.0
        3         1.0
        4         2.0
        dtype: float64
        r÷  )rZ  r   rL  s     €ra   r   zRolling.first  s   ø€ ôH ‰w‰}¨,ˆ}Ó7Ð7rc   c                ó$   •— t         ‰| �  |¬«      S )aù  
        Calculate the rolling Last (right-most) element of the window.

        Return the last observed value in each rolling window. This is useful
        for tracking the most recent value of a window as it slides forward.

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        GroupBy.last : Similar method for GroupBy objects.
        Rolling.first : Method to get the first element in each window.

        Examples
        --------
        The example below will show a rolling calculation with a window size of
        three.

        >>> s = pd.Series(range(5))
        >>> s.rolling(3).last()
        0         NaN
        1         NaN
        2         2.0
        3         3.0
        4         4.0
        dtype: float64
        r÷  )rZ  r  rL  s     €ra   r  zRolling.last*  s   ø€ ôH ‰w‰|¨ˆ|Ó6Ð6rc   c                ó(   •— t         ‰| �  |||¬«      S )a  
        Calculate the rolling quantile.

        Return the ``q``-th quantile of the values in each rolling window. The
        ``interpolation`` parameter controls how quantiles falling between two
        data points are handled.

        Parameters
        ----------
        q : float
            Quantile to compute. 0 <= quantile <= 1.

        interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'}
            This optional parameter specifies the interpolation method to use,
            when the desired quantile lies between two data points `i` and `j`:

                * linear: `i + (j - i) * fraction`, where `fraction` is the
                  fractional part of the index surrounded by `i` and `j`.
                * lower: `i`.
                * higher: `j`.
                * nearest: `i` or `j` whichever is nearest.
                * midpoint: (`i` + `j`) / 2.

        numeric_only : bool, default False
            Include only float, int, boolean columns.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.quantile : Aggregating quantile for Series.
        DataFrame.quantile : Aggregating quantile for DataFrame.

        Examples
        --------
        >>> s = pd.Series([1, 2, 3, 4])
        >>> s.rolling(2).quantile(0.4, interpolation="lower")
        0    NaN
        1    1.0
        2    2.0
        3    3.0
        dtype: float64

        >>> s.rolling(2).quantile(0.4, interpolation="midpoint")
        0    NaN
        1    1.5
        2    2.5
        3    3.5
        dtype: float64
        )r	  r  r†   )rZ  r  )r`   r	  r  r†   r[  s       €ra   r  zRolling.quantileP  s&   ø€ ôz ‰wÑØØ'Ø%ð  ó 
ð 	
rc   c                ó*   •— t         ‰| �  ||||¬«      S )a   
        Calculate the rolling rank.

        Compute the rank of each value within each rolling window. Ties are
        resolved using the ``method`` parameter.

        Parameters
        ----------
        method : {'average', 'min', 'max'}, default 'average'
            How to rank the group of records that have the same value (i.e. ties):

            * average: average rank of the group
            * min: lowest rank in the group
            * max: highest rank in the group

        ascending : bool, default True
            Whether or not the elements should be ranked in ascending order.

        pct : bool, default False
            Whether or not to display the returned rankings in percentile
            form.

        numeric_only : bool, default False
            Include only float, int, boolean columns.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.rank : Aggregating rank for Series.
        DataFrame.rank : Aggregating rank for DataFrame.

        Examples
        --------
        >>> s = pd.Series([1, 4, 2, 3, 5, 3])
        >>> s.rolling(3).rank()
        0    NaN
        1    NaN
        2    2.0
        3    2.0
        4    3.0
        5    1.5
        dtype: float64

        >>> s.rolling(3).rank(method="max")
        0    NaN
        1    NaN
        2    2.0
        3    2.0
        4    3.0
        5    2.0
        dtype: float64

        >>> s.rolling(3).rank(method="min")
        0    NaN
        1    NaN
        2    2.0
        3    2.0
        4    3.0
        5    1.0
        dtype: float64
        )rX   r  r  r†   )rZ  r  )r`   rX   r  r  r†   r[  s        €ra   r  zRolling.rank“  s(   ø€ ôT ‰w‰|ØØØØ%ð	 ó 
ð 	
rc   c                ó$   •— t         ‰| �  |¬«      S )a�  
        Calculate the rolling nunique.

        .. versionadded:: 3.0.0

        Parameters
        ----------
        numeric_only : bool, default False
            Include only float, int, boolean columns.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.nunique : Aggregating nunique for Series.
        DataFrame.nunique : Aggregating nunique for DataFrame.

        Examples
        --------
        >>> s = pd.Series([1, 4, 2, np.nan, 3, 3, 4, 5])
        >>> s.rolling(3).nunique()
        0    NaN
        1    NaN
        2    3.0
        3    NaN
        4    NaN
        5    NaN
        6    2.0
        7    3.0
        dtype: float64
        r÷  )rZ  r  rL  s     €ra   r  zRolling.nuniqueä  s   ø€ ôP ‰w‰Ø%ð ó 
ð 	
rc   c                ó*   •— t         ‰| �  ||||¬«      S )a  
        Calculate the rolling sample covariance.

        Compute the sample covariance between the calling object and ``other``
        over each rolling window. If ``other`` is not supplied, pairwise
        covariances of the columns are computed.

        Parameters
        ----------
        other : Series or DataFrame, optional
            If not supplied then will default to self and produce pairwise
            output.

        pairwise : bool, default None
            If False then only matching columns between self and other will be
            used and the output will be a DataFrame.
            If True then all pairwise combinations will be calculated and the
            output will be a MultiIndexed DataFrame in the case of DataFrame
            inputs. In the case of missing elements, only complete pairwise
            observations will be used.

        ddof : int, default 1
            Delta Degrees of Freedom.  The divisor used in calculations
            is ``N - ddof``, where ``N`` represents the number of elements.

        numeric_only : bool, default False
            Include only float, int, boolean columns.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.cov : Aggregating cov for Series.
        DataFrame.cov : Aggregating cov for DataFrame.

        Examples
        --------
        >>> ser1 = pd.Series([1, 2, 3, 4])
        >>> ser2 = pd.Series([1, 4, 5, 8])
        >>> ser1.rolling(2).cov(ser2)
        0    NaN
        1    1.5
        2    0.5
        3    1.5
        dtype: float64
        ©r  r  r°  r†   )rZ  r  ©r`   r  r  r°  r†   r[  s        €ra   r  zRolling.cov  s(   ø€ ôt ‰w‰{ØØØØ%ð	 ó 
ð 	
rc   c                ó*   •— t         ‰| �  ||||¬«      S )a_  
        Calculate the rolling correlation.

        Compute the Pearson correlation coefficient between the calling object
        and ``other`` over each rolling window. If ``other`` is not supplied,
        pairwise correlations of the columns are computed.

        Parameters
        ----------
        other : Series or DataFrame, optional
            If not supplied then will default to self and produce pairwise
            output.

        pairwise : bool, default None
            If False then only matching columns between self and other will be
            used and the output will be a DataFrame.
            If True then all pairwise combinations will be calculated and the
            output will be a MultiIndexed DataFrame in the case of DataFrame
            inputs. In the case of missing elements, only complete pairwise
            observations will be used.

        ddof : int, default 1
            Delta Degrees of Freedom.  The divisor used in calculations
            is ``N - ddof``, where ``N`` represents the number of elements.

        numeric_only : bool, default False
            Include only float, int, boolean columns.

        Returns
        -------
        Series or DataFrame
            Return type is the same as the original object with ``np.float64`` dtype.

        See Also
        --------
        cov : Similar method to calculate covariance.
        numpy.corrcoef : NumPy Pearson's correlation calculation.
        Series.rolling : Calling rolling with Series data.
        DataFrame.rolling : Calling rolling with DataFrames.
        Series.corr : Aggregating corr for Series.
        DataFrame.corr : Aggregating corr for DataFrame.

        Notes
        -----
        This function uses Pearson's definition of correlation
        (https://en.wikipedia.org/wiki/Pearson_correlation_coefficient).

        When `other` is not specified, the output will be self correlation (e.g.
        all 1's), except for :class:`~pandas.DataFrame` inputs with `pairwise`
        set to `True`.

        Function will return ``NaN`` for correlations of equal valued sequences;
        this is the result of a 0/0 division error.

        When `pairwise` is set to `False`, only matching columns between `self` and
        `other` will be used.

        When `pairwise` is set to `True`, the output will be a MultiIndex DataFrame
        with the original index on the first level, and the `other` DataFrame
        columns on the second level.

        In the case of missing elements, only complete pairwise observations
        will be used.

        Examples
        --------
        The below example shows a rolling calculation with a window size of
        four matching the equivalent function call using :meth:`numpy.corrcoef`.

        >>> v1 = [3, 3, 3, 5, 8]
        >>> v2 = [3, 4, 4, 4, 8]
        >>> np.corrcoef(v1[:-1], v2[:-1])
        array([[1.        , 0.33333333],
            [0.33333333, 1.        ]])
        >>> np.corrcoef(v1[1:], v2[1:])
        array([[1.       , 0.9169493],
            [0.9169493, 1.       ]])
        >>> s1 = pd.Series(v1)
        >>> s2 = pd.Series(v2)
        >>> s1.rolling(4).corr(s2)
        0         NaN
        1         NaN
        2         NaN
        3    0.333333
        4    0.916949
        dtype: float64

        The below example shows a similar rolling calculation on a
        DataFrame using the pairwise option.

        >>> matrix = np.array(
        ...     [[51.0, 35.0], [49.0, 30.0], [47.0, 32.0], [46.0, 31.0], [50.0, 36.0]]
        ... )
        >>> np.corrcoef(matrix[:-1, 0], matrix[:-1, 1])
        array([[1.       , 0.6263001],
            [0.6263001, 1.       ]])
        >>> np.corrcoef(matrix[1:, 0], matrix[1:, 1])
        array([[1.        , 0.55536811],
            [0.55536811, 1.        ]])
        >>> df = pd.DataFrame(matrix, columns=["X", "Y"])
        >>> df
              X     Y
        0  51.0  35.0
        1  49.0  30.0
        2  47.0  32.0
        3  46.0  31.0
        4  50.0  36.0
        >>> df.rolling(4).corr(pairwise=True)
                    X         Y
        0 X        NaN       NaN
          Y        NaN       NaN
        1 X        NaN       NaN
          Y        NaN       NaN
        2 X        NaN       NaN
          Y        NaN       NaN
        3 X   1.000000  0.626300
          Y   0.626300  1.000000
        4 X   1.000000  0.555368
          Y   0.555368  1.000000
        rf  )rZ  r  rg  s        €ra   r  zRolling.corrQ  s(   ø€ ô~ ‰w‰|ØØØØ%ð	 ó 
ð 	
rc   r>  )rH  r;  r¦   r?  r¶  r"  r#  r%  r&  r'  r(  r)  r*  r+  r·  r¸  r,  r.  r0  r2  r3  r4  )!rr   rJ  rK  rK   rM  r_   r9  rC  r7  r3  rò   r4  r   rË  r   r¥  rÙ  rÞ  r¬  ræ  rµ  r±  rñ  rõ  rý  r   r  r  r  r  r  r  rŽ  r�  s   @ra   r6  r6  ª  sÛ  ø… ò	€K�ó 	õ/GóbDó(õR8ðh €Cö.+ðf Ø48Ø04Ø'+Ø(,ðr
à ðr
ð ðr
ð 2ð	r
ð
 .ðr
ð %ðr
ð &õr
ðh ðà/ðð ðð ð	ð
 
òó ðð ðà*ðð ðð ð	ð
 
òó ðð ðT3àNðT3ð ðT3ð ð	T3ð
 
ôT3ó ðT3ðp #Ø48Ø04ð	b
àðb
ð 2ðb
ð .õ	b
ðL #ðG
ð 59Ø04ñG
àðG
ð 2ð	G
ð
 .õG
ðV #Ø48Ø04ð	B
àðB
ð 2ðB
ð .õ	B
ðL #Ø48Ø04ð	I
àðI
ð 2ðI
ð .õ	I
ðZ #Ø48Ø04ð	C
àðC
ð 2ðC
ð .õ	C
ðN Ø"Ø48Ø04ðK
àðK
ð ðK
ð 2ð	K
ð
 .õK
ð^ Ø"Ø48Ø04ðK
àðK
ð ðK
ð 2ð	K
ð
 .õK
öZ*7ôX.ö`27öh$8öL$7ðR 08Ø"ð	A
àðA
ð -ðA
ð õ	A
ðJ %.ØØØ"ðO
à!ðO
ð ðO
ð ð	O
ð
 õO
ðf #ð*
àõ*
ð\ ,0Ø $ØØ"ð?
à(ð?
ð ð?
ð ð	?
ð
 õ?
ðF ,0Ø $ØØ"ðD
à(ðD
ð ðD
ð ð	D
ð
 ÷D
ñ D
rc   r6  c                  óR   — e Zd ZdZej
                  ej
                  z   Zdd„Zdd„Zy)ÚRollingGroupByz3
    Provide a rolling groupby implementation.
    c                óÔ  — d}| j                   }t        | j                  t        «      rjt	        | j                  «      }| j                  j
                  j                  «       }t        |t        «      sJ ‚|j                  dd«       | j                  }n1| j                  �t        }| j                  }nt        }| j                  }t        ||| j                  j                  ||¬«      }|S )z“
        Return an indexer class that will compute the window start and end bounds

        Returns
        -------
        GroupByIndexer
        Nrï   )rï   rð   Úgroupby_indicesr  Úindexer_kwargs)rç   r[   rT   r$   rl   Ú__dict__rÓ   Údictr³  rY   r'   r%   r&   rR  ra  )r`   rm  rï   Úrolling_indexerrT   r  s         ra   r»   z"RollingGroupBy._get_window_indexerã  sÈ   € ð 15ˆØ×'Ñ'ˆÜ�d—k‘k¤;Ô/Ü" 4§;¡;Ó/ˆOØ!Ÿ[™[×1Ñ1×6Ñ6Ó8ˆNÜ˜n¬dÔ3Ð3Ð3à×Ñ˜}¨dÔ3Ø—[‘[‰FØ×ÑÐ*Ü3ˆOð ×&Ñ&‰Fä0ˆOØ—[‘[ˆFÜ'Ø#ØØ ŸM™M×1Ñ1Ø*Ø)ô
ˆð Ðrc   c                ód  — | j                   j                  r| j                  d«       | j                  j                  j                  «       D ]b  }| j                   j                  |«      }|j                  rŒ+|j                  rŒ8| j                  €dn| j                  }t        d|› d|› d�«      ‚ y)zC
        Validate that each group in self._on is monotonic
        rA  NrZ   zEach group within z' must be monotonic. Sort the values in z first.)rM   rB  rC  rR  ra  rÌ   r  rD  rE  rQ   r]   )r`   ro  Úgroup_onrQ   s       ra   r9  z/RollingGroupBy._validate_datetimelike_monotonic  s�   € ð
 �8‰8×ÒØ×'Ñ'Ð(BÔCØ!Ÿ]™]×2Ñ2×9Ñ9Ó;ò 		ˆMØ—x‘x—}‘} ]Ó3ˆHà×0Ó0°H×4TÓ4Tà $§¡ ‘W°T·W±W�Ü Ø(¨¨ð -*Ø*,¨¨Wð6óð ñ		rc   N)r<  r&   r>  )	rr   rJ  rK  rL  r6  rK   rQ  r»   r9  rF  rc   ra   rj  rj  Û  s+   „ ñð ×%Ñ%Ð(9×(EÑ(EÑE€Kó!ôFrc   rj  )urL  Ú
__future__r   rÓ   Údatetimer   Ú	functoolsr   rm   Útypingr   r   r   r	   r
   r   r   r   ÚnumpyrÆ   Úpandas._libs.tslibsr   r   r   Ú pandas._libs.window.aggregationsÚ_libsrT   Úaggregationsr§  Úpandas.compat._optionalr   Úpandas.errorsr   Úpandas.util._decoratorsr   Úpandas.core.dtypes.commonr   r   r   r   r   r   Úpandas.core.dtypes.dtypesr   Úpandas.core.dtypes.genericr   r   Úpandas.core.dtypes.missingr   Úpandas.core._numbar   Úpandas.core.algorithmsr   Úpandas.core.applyr    r!   Úpandas.core.arraysr"   Úpandas.core.baser#   Úpandas.core.commonÚcoreÚcommonrw  Úpandas.core.indexers.objectsr$   r%   r&   r'   Úpandas.core.indexes.apir(   r)   r*   r+   r,   Úpandas.core.reshape.concatr-   Úpandas.core.util.numba_r.   r/   r0   Úpandas.core.window.commonr1   r2   Úpandas.core.window.numba_r3   r4   r5   Úcollections.abcr6   r7   r8   r9   Úpandas._typingr:   r;   r<   r=   r>   r?   r@   rA   rÔ   rB   rC   Úpandas.core.genericrD   rW  rF   Úpandas.core.arrays.datetimelikerG   rI   rQ  r‘  rº  r6  rj  rF  rc   ra   ú<module>r•     s�  ðñõ
 #ã Ý Ý Û ÷	÷ 	ó 	ó ÷ñ ÷
 ?Ó >Ý >Ý #Ý .÷÷ õ 1÷õ -å 'Ý ,÷õ .Ý +ß  Ð  ÷ó ÷õ õ .÷ñ ÷
÷ñ ñ Ý(÷ñ ÷	÷ 	ó 	÷õ ,Ý3å 9ôa� 	Ñ*ô aôHF:˜
ô F:ñR ÐÓ ôc

ˆZó c

ó !ðc

ôL^
˜zô ^
ñB ÐÓ ôj
Ð&ó j
ó !ðj
ðZ1 —.‘.€„ñ ÐÓ ô:Ð&¨ó :ó !ñ:rc   