+
    xȇi4                        ^ RI H t  ^ RIHt ^ RIt^ RIt^ RIt^ RIHtH	t	H
t
Ht ^ RIHt ^ RIHt ^ RIHt ]P&                  R 4       tR tR	 tR
 tR t]P2                  P5                  R]	! ^^.4      ]	! RR.4      ]	! RR.4      ]P6                  P9                  ^^.RR..4      .4      R 4       tR tR t]P2                  PA                  RR7      R 4       t!]P2                  P5                  RR/ ^ 3RR^ /^ 3RR^/]PD                  3R/ ^3RR^ /^3RR^/]PD                  3.4      R 4       t#]P2                  P5                  RR]PD                  3R]PD                  3R(R)R*.4      R 4       t$R  t%R! t&]P2                  P5                  R"R/ . R+O3RR^ /. R+O3RR^/^]PD                  ^.3RR^/]PD                  ]PD                  ]PD                  .3R/ . R,O3RR^ /. R,O3RR^/^]PD                  ^.3RR^/]PD                  ]PD                  ]PD                  .3.4      R# 4       t']P&                  R$ 4       t(R% t)R& t*R' t+R# )-    )datetime)methodcallerN)	DataFrameIndexSeries	Timestamp)Grouper)
date_rangec                      \        \        P                  P                  ^4      P	                  R4      \        RRR7      R7      # )     z1/1/2000)periodsindex)r   nprandomdefault_rngstandard_normalr
        w/Users/max/.openclaw/workspace/postharvest/venv/lib/python3.14/site-packages/pandas/tests/resample/test_time_grouper.pytest_seriesr      s6    
		a 006T2 r   c                 Z   \        R RRR7      pV P                  V4      pR pVP                  V4      pV P                  R 4      P                  V4      pVP                  P	                  ^ 4      Vn        VP                  P	                  ^ 4      Vn        \
        P                  ! WE4       R# )YErightfreqlabelclosedc                 (    V P                  4       RR # )   N)sort_valuesxs   &r   ftest_apply.<locals>.f    s    }}rs##r   c                     V P                   # Nyearr$   s   &r   <lambda>test_apply.<locals>.<lambda>$       QVVr   N)r	   groupbyapplyr   	dropleveltmassert_series_equal)r   groupergroupedr&   appliedexpecteds   &     r   
test_applyr8      s    4ww?G!!'*G$ mmAG""#34::1=HMM++A.GM^^--a0HN7-r   c                    \         P                  V R &   V P                  R 4      P                  4       p\	        RRRR7      pV P                  V4      P                  4       pVP
                  Vn        \        P                  ! W14       V P                  R4      P                  4       pVP
                  Vn        \        P                  ! W14       R# ):NNr!   c                     V P                   # r)   r*   r$   s   &r   r,   test_count.<locals>.<lambda>.   r.   r   r   r   r   N)	r   nanr/   countr	   r   r2   r3   resample)r   r7   r4   results   &   r   
test_countr@   +   s    vvK""#34::<H4ww?G  )//1F\\HN6,!!$'--/F\\HN6,r   c                     V P                  R RR7      P                  4       pV P                  R 4      P                  \        P                  4      pVP
                  Vn        \        P                  ! W4       R# )r   r   )r   c                     V P                   # r)   r*   r$   s   &r   r,   &test_numpy_reduction.<locals>.<lambda><   r.   r   N)r>   prodr/   aggr   r   r2   r3   )r   r?   r7   s   &  r   test_numpy_reductionrF   :   sY    !!$w!7<<>F""#3488AH\\HN6,r   c                  *   R p \        RRV R7      p\        R^R^/VR7      p\        RR7      pVP                  V4      w  rEVP	                  VR	R
7      pR pVP                  V4      p\        P                  ! VP                  VP                  4       R# )r   
2000-01-01D)startr   r   opencloser   MEr   F)
group_keysc                 0    V R ,          V R,          ,          # )rL   rK   r   )dfs   &r   r&   test_apply_iteration.<locals>.fM   s    '{RZ''r   N)	r
   r   r	   _get_grouperr/   r0   r2   assert_index_equalr   )	NindrQ   tgr4   _r5   r&   r?   s	            r   test_apply_iterationrY   A   s    A
<c1
=C	FAw*#	6B	d	B$JG jjUj3G( ]]1F&,,1r   r   abg?g@c                 6   \        V 4      P                  p\        R \        \	        V 4      4      /V R7      pRV R2p\
        P                  ! \        VR7      ;_uu_ 4        VP                  \        RR7      4       RRR4       R#   + '       g   i     R# ; i)rZ   r   zVOnly valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of ''matchrI   rN   N)
type__name__r   rangelenpytestraises	TypeErrorr/   r	   )r   namerQ   msgs   &   r   test_fails_on_no_datetime_indexri   U   sv     ;D	Cs5z*+5	9B	337&	;  
y	,	,


7$% 
-	,	,	,s   !BB	c            	         ^p \         P                  P                  ^4      P                  V ^34      p\	        V. ROR7      p\        R^^4      \        R^^4      \        R^^4      \        R^^4      \        R^^4      .^,          VR&   VP                  \        RRR7      4      p\        P                  ! VP                  \        R^^4      4      VR,          4       \        P                  ! VP                  \        R^^4      4      VR,          4       \        P                  ! VP                  \        R^^4      4      VR,          4       \        P                  ! VP                  \        R^^4      4      VR	,          4       \        P                  ! VP                  \        R^^4      4      VR
,          4       R# )   rI   columns  keyro   r   :NN   :   Nrq   :r   Nrq   :r!   Nrq   :   Nrq   NABCrI   )r   r   r   r   r   r   r/   r	   r2   assert_frame_equal	get_group)ndatarQ   r5   s       r   test_aaa_group_orderr|   j   si    	A99  #33QF;D	4!5	6Bq!q!q!q!q! 	

BuI jjU56G'++HT1a,@A2c7K'++HT1a,@A2d8L'++HT1a,@A2d8L'++HT1a,@A2d8L'++HT1a,@A2d8Lr   c                P   \         P                  P                  ^4      P                  R4      p\	        V. ROR7      p. RO^,          VR&   \	        V. ROR7      p\        \        R^^4      \        R^^4      \        R^^4      \        R^^4      \        R^^4      .^,          RR7      VR&   VP                  R4      pVP                  \        RRR7      4      p\        W@4      ! 4       p\        WP4      ! 4       p\        RR^R	RR
7      Vn        \        P                  ! Wg4       R# )?Check TimeGrouper's aggregation is identical as normal groupby.rI   rl   ro   rn   M8[ns]dtyperp   
2013-01-01ns)rJ   r   r   unitrg   Nrk   rs   rt   rr   r   r!   rs   rq   )r   r   r   r   r   r   r   r/   r	   getattrr
   r   r2   assert_equal)resample_methodr{   	normal_dfdt_dfnormal_grouped
dt_groupedr7   	dt_results   &       r   test_aggregate_normalr      s    99  #33G<D$(<=I&*Ied$89ET1a T1a T1a T1a T1a 	
 	 
E%L &&u-Nw5s;<J~79H
46IadHN OOH(r   z7if TimeGrouper is used included, 'nth' doesn't work yet)reasonc            	     <   \         P                  P                  ^4      P                  R	4      p \	        V . R
OR7      p. RO^,          VR&   \	        V . R
OR7      p\        R^^4      \        R^^4      \        R^^4      \        R^^4      \        R^^4      .^,          VR&   VP                  R4      pVP                  \        RRR7      4      pVP                  ^4      p\        RR^RR7      Vn
        VP                  ^4      p\        P                  ! WV4       R# )r~   rI   rl   ro   rn   rp   r   )rJ   r   r   rg   Nr   rt   r   )r   r   r   r   r   r   r/   r	   nthr
   r   r2   rx   )r{   r   r   r   r   r7   r   s          r   test_aggregate_nthr      s    99  #33G<D$(<=I&*Ied$89Eq!q!q!q!q! 	

E%L &&u-Nw5s;<J!!!$HlaeTHNq!I(.r   zmethod, method_args, unitsum	min_countrD   c           	      D   \        ^ .^,          \        P                  .^,          ,           \        R^RR7      R7      p\	        V 3/ VB ! VP                  R4      4      p\        P                  ! RR.RRR	7      p\        R
V.VR7      p\        P                  ! WF4       R# )r   2017r   )r   r   r   2Dz
2017-01-01z
2017-01-03r   r   r   g        N)
r   r   r<   r
   r   r>   pdDatetimeIndexr2   r3   )methodmethod_argsr   serr?   exp_dtir7   s   &&&    r   !test_resample_entirely_nat_windowr      s     !qBFF8a<'z&!RV/W
XC&0K0d1CDFl;8RVWGsDk1H6,r   zfunc, fill_valueminmaxc                    ^p\         P                  P                  ^4      P                  V^34      P	                  R4      p\        V. ROR7      p^^\         P                  ^^.^,          VR&   \        V. ROR7      p\        \        R^^4      \        R^^4      \        P                  \        R^^4      \        R^^4      .^,          RR7      VR&   VP                  R4      pVP                  \        RRR7      4      p\        W`4      ! 4       p\        Wp4      ! 4       p	\        V.^,          .^.. ROR	7      p
\        P                  ! W.4      pVP                  4       p\!        R
R^RVR,          P"                  P$                  R7      pVP'                  R4      Vn        \*        P,                  ! W4       V	P(                  P.                  R8X  g   Q hR# )rk   int64rI   rl   ro   rn   r   r   rp   )r   rm   r   rJ   r   r   rg   r   Nrt   )r   r   r   r   astyper   r<   r   r   r   NaTr/   r	   r   concat
sort_indexr
   _valuesr   
_with_freqr   r2   rx   rg   )func
fill_valuerz   r{   r   r   r   r   normal_resultr   padr7   dtis   &&           r   test_aggregate_with_natr      s    	A99  #33QF;BB7KD$(<=I1bffa+a/Ied$89ET1a T1a FFT1a T1a 	
 	 
E%L &&u-Nw5s;<JN13M
)+I
j\A%&qc;O
PCyy--.H""$H
5\!!&&C ^^D)HN(.??5(((r   c                     ^p \         P                  P                  ^4      P                  V ^34      P	                  R4      p\        V. ROR7      p^^\         P                  ^^.^,          VR&   \        V. ROR7      p\        \        R^^4      \        R^^4      \        P                  \        R^^4      \        R^^4      .^,          RR7      VR&   VP                  R4      pVP                  \        RRR7      4      pVP                  4       pVP                  4       p\        ^ .^.R	7      p\        P                  ! Wh.4      p	V	P!                  4       p	\#        R
R^RVR,          P$                  P&                  R7      P)                  R4      V	n        \,        P.                  ! W4       VP*                  P0                  R8X  g   Q hR# )rk   r   rI   rl   ro   rn   r   r   rp   r   r   r   Nrt   )r   r   r   r   r   r   r<   r   r   r   r   r/   r	   sizer   r   r   r
   r   r   r   r   r2   r3   rg   )
rz   r{   r   r   r   r   r   r   r   r7   s
             r   test_aggregate_with_nat_sizer      s   
A99  #33QF;BB7KD$(<=I1bffa+a/Ied$89ET1a T1a FFT1a T1a 	
 	 
E%L &&u-Nw5s;<J"'')M!I
!QC
 Cyy--.H""$H5\!!&& j N 8/??5(((r   c                      \        \        R RR7      4      p RpW8X  g   Q h\        \        R RRR7      4      p RpW8X  g   Q hR# )ru   hrp   zTimeGrouper(key='A', freq=<Hour>, sort=True, dropna=True, closed='left', label='left', how='mean', convention='e', origin='start_day')rH   )ro   r   originzTimeGrouper(key='A', freq=<Hour>, sort=True, dropna=True, closed='left', label='left', how='mean', convention='e', origin=Timestamp('2000-01-01 00:00:00'))N)reprr	   )r?   r7   s     r   	test_reprr   %  sW    'c,-F	. 
 'cLABF	C 
 r   z$method, method_args, expected_valuesc           
          \        ^\        R^RRR7      R7      pVP                  R4      p\        P                  ! . R
ORRR7      p\        V 3/ VB ! V4      p\        W%R7      p\        P                  ! Wg4       R	# )rr   r   r   r   r   r   r   r   30minr   r   N)z2017-01-01T00:00:00z2017-01-01T00:30:00z2017-01-01T01:00:00)r   r
   r>   r   r   r   r2   r3   )r   r   expected_valuesr   	resampledr   r?   r7   s   &&&     r   test_upsample_sumr   8  sp     *VQStL
MCW%IME
 &0K0;Fo3H6,r   c            
      F    \        R . ROR. RO/\        R^RRR7      R7      # )	pricevolumez
01/01/2018Wr   r   r   )
      	   )2   <   r   )r   r
   r   r   r   groupy_test_dfr   R  s)    	+x6qsF r   c                 B   V P                  4       pR VP                  n        W.pV F`  p\        P                  ! \
        RR7      ;_uu_ 4        VP                  R4      P                  R4      P                  RR7       R R R 4       Kb  	  R #   + '       g   i     Kw  ; i)Nz?Direct interpolation of MultiIndex data frames is not supportedr^   r   1Dlinearr   )	copyr   rg   rd   re   NotImplementedErrorr/   r>   interpolate)r   !groupy_test_df_without_index_namedfsrQ   s   &   r   (test_groupby_resample_interpolate_raisesr   Z  s     )7(;(;(=%37%++0
=C]]S
 
 JJx ))$/;;8;L	
 
 
 
 
s   1BBc           
         V P                  4       pR VP                  n        W.pV F  pVP                  R4      P	                  R 4      p^2.^,          ^<.,           p. \        \        RRRR7      4      O\        R4      Np\        P                  P                  WV.RVP                  P                  .R7      p\        R	. RO/VR
7      p\        P                  ! WH4       K  	  R # )Nr   c                 D    V P                  R 4      P                  RR7      # )r   r   r   r>   r   r$   s   &r   r,   Etest_groupby_resample_interpolate_with_apply_syntax.<locals>.<lambda>v  s    ajj&22(2Cr   
2018-01-07z
2018-01-21r   )r   
2018-01-14namesr   r{   r   )      $@gm۶m#@gn۶m۶#@g%I$I#@g۶m۶m#@g$I$I#@gI$I$#@      #@gm۶m"@gn۶m۶"@g%I$I"@g۶m۶m"@g$I$I"@gI$I$"@g      "@      &@)r   r   rg   r/   r0   listr
   r   r   
MultiIndexfrom_arraysr   r2   rx   )	r   r   r   rQ   r?   r   week_startingexpected_indr7   s	   &        r   3test_groupby_resample_interpolate_with_apply_syntaxr   k  s     )7(;(;(=%37%++0
=CH%++C
 bT!
*\<dCD
l#
 }}00#RXX]]+ 1 

  ( +
. 	f/M r   c                p   V P                  R4      P                  R 4      p. ROp\        P                  ! \	        R4      \	        R4      \	        R4      .4      P                  R4      p\        P                  P                  W#.RR.R7      p\        R	. RO/VR
7      p\        P                  ! WRR7       R# )zSimilar test as test_groupby_resample_interpolate_with_apply_syntax but
with resampling that results in missing anchor points when interpolating.
See GH#21351.r   c                 D    V P                  R 4      P                  RR7      # )265hr   r   r   r$   s   &r   r,   Ntest_groupby_resample_interpolate_with_apply_syntax_off_grid.<locals>.<lambda>  s    !**V$000Ar   r   z2018-01-18 01:00:00r   r   r   r   r   r   F)check_namesN)r   r   r   )r   r   r   )r/   r0   r   r   r   as_unitr   r   r   r2   rx   )r   r?   r   r   r   r7   s   &     r   <test_groupby_resample_interpolate_with_apply_syntax_off_gridr     s    
 ##H-33AF F$$l#+,l#	
 gdm  ==,,	) - L
 ()H &>r   )r   r   )rD   rr   )r=   r   )rr   r   rr   )rr   rr   rr   ),r   operatorr   numpyr   rd   pandasr   r   r   r   r   pandas._testing_testingr2   pandas.core.groupby.grouperr	   pandas.core.indexes.datetimesr
   fixturer   r8   r@   rF   rY   markparametrizer   r   ri   r|   r   xfailr   r<   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s    !      / 4  . --2( q!fsCjsCj
!!Aq6C:"67		&	&M,)> ST/ U/2 	A	a !$	a "&&)	Q	+q!1%	+q!266*
-
- RVV_ubffoz;M))	))X%)P& *	I	a ),	a 1bffa.1	a 266266266":;	Y	+q!9-	+q!Arvvq>2	+q!BFFBFFBFF#;<	
-
-  M"/0d?r   