
    A[gw                        d dl Zd dlZd dlZd dlmZ d dlmZ ej                  j                  dddg      d        Zej                  j                  ddd	g      d
        Zd Zd Zd Zej                  j                  ddd	g      d        Zd Zd Zej                  j                  dej&                  ej(                  g      ej                  j                  dddid e       ig      d               Zd Zd Zd Zd Zd Zd Zy)    N)Serieszoperation, expected)mina)maxbc                 R    t        ddgd      } t        ||              }||k(  sJ y )Nr   r   stringdtype)r   getattr)	operationexpectedserres_operation_series       ^/var/www/html/bid-api/venv/lib/python3.12/site-packages/pandas/tests/series/test_reductions.pytest_reductions_series_stringsr   	   s4     #s8
,C1'#y13(***    	as_periodTFc           
      r   t        t        dd      D cg c]  }t        j                  dd|       c}      }| r|j                  j                  d      }n|j                  j                  d      }|j                         }|j                  |j                  k(  sJ t        j                  ||       y c c}w )N      i     Dz
US/Central)r   rangepd	Timestampdt	to_periodtz_localizemoder   tmassert_series_equal)r   nr   ress       r   test_mode_extension_dtyper%      s     E!QK@Kq",,tQ*K@
ACffs#ff  .
((*C99		!!!3$ As   B4c           	      z   t        dddt        j                  ddt        j                  g|       }|j                  d      }t        ddt        j                  g|       }t	        j
                  ||       |j                  d      }t        ddg|       }t	        j
                  ||       t        j                  |d<   |j                  d      }t        ddg|       }t	        j
                  ||       |j                  d      }t        t        j                  g|       }t	        j
                  ||       y )	Nr         r
   F)dropnaT)r   r   NAr    r!   r"   )any_numeric_ea_dtyper   resultr   s       r   test_mode_nullable_dtyper.       s    
!Q255!Q.6J
KCXXUX#Fq!RUUm+?@H68,XXTX"Fq!f$89H68,eeCGXXTX"Fq!f$89H68,XXUX#Fruug%9:H68,r   c                     t        j                  d       t        ddgt              } t	        j
                  dd      5  | j                         }d d d        t        ddgt              }t        j                  |       y # 1 sw Y   3xY w)Npyarrowr   r   r
   zfuture.infer_stringT)	pytestimportorskipr   objectr   option_contextr    r!   r"   )r   r-   r   s      r   test_mode_infer_stringr5   6   sj    
	"
#s6
*C			0$	7 
8sCj/H68, 
8	7s   BBc                      t        dt        j                  gd      } | d   }| j                         |k(  sJ | j	                         |k(  sJ | j                         |k(  sJ y )Nr   zm8[ns]r
   )r   r   NaTmedianr   r   )r   exps     r   test_reductions_td64_with_natr:   @   s[    
!RVVH
-C
a&C::<3779779r   skipnac                     t        g d      }|j                  |       }t        |t        j                        sJ |t        j                  d      k(  sJ y )Nztimedelta64[ns]r
   )r;   r   )r   sum
isinstancer   	Timedelta)r;   r   r-   s      r   test_td64_sum_emptyr@   I   sK     ,
-CWWFW#Ffbll+++R\\!_$$$r   c                     t        t        j                  ddd            } | dxx   t        j                  d      z  cc<   | | j	                         z
  j                         }t        j                  t        j                  | | j	                         z
        j                  t        |       z  j                               }t        j                  |j                  dz  |j                  dz        sJ d}t        j                  t        |	      5  | | j	                         z
  j                          d d d        | dd
 }t        j                  t        |	      5  ||j	                         z
  j                          d d d        | dd }||j	                         z
  j                          y # 1 sw Y   zxY w# 1 sw Y   <xY w)N20130101i h)periodsfreqr   z1s 1msi  zoverflow in timedelta operationmatchi'  )r   r   
date_ranger?   r   meanTimedeltaIndexasi8lenr=   npallclose_valuer1   raises
ValueError)r   r-   r   msgs1s2s         r   test_td64_summation_overflowrU   S   sF   
z6D
ECFbll8$$F CGGIo##%F||R..sSWWY?DDs3xOTTVWH ;;v}}t+X__t-CDDD ,C	z	-	swwy 
. 
QuB	z	-	bffh 
.	QtB"&&(] 
.	- 
.	-s   "F*"F6*F36F?c                  x    t        g dt        d            } | j                         }t        |t               rJ y )N)      ?rW   rW   r'   )index)r   r   prodr>   )r   r-   s     r   test_prod_numpy16_bugrZ   l   s0    
a
1CXXZF&&))))r   funckwargskeepdimsoutc                     t        ddg      }t        t        |             }|j                  }d| d| d}t	        j
                  t        |      5   ||fi |  d d d        y # 1 sw Y   y xY w)Nr   r(   zthe 'z=' parameter is not supported in the pandas implementation of z\(\)rF   )r   nextiter__name__r1   rP   rQ   )r\   r[   r   paramnamerR   s         r   )test_validate_any_all_out_keepdims_raisesre   s   sp     !Q.CfE==D w "V4	) 
 
z	-SF 
.	-	-s   
A%%A.c                      t        ddg      } d}t        j                  t        |      5  t	        j
                  | d       d d d        y # 1 sw Y   y xY w)Nr   r(   zPthe 'initial' parameter is not supported in the pandas implementation of sum\(\)rF   
   )initialr   r1   rP   rQ   rM   r=   r   rR   s     r   test_validate_sum_initialrk      sC    
!Q.C	% 
 
z	-
sB 
.	-	-   AAc                      t        ddg      } d}t        j                  t        |      5  | j	                  d       d d d        y # 1 sw Y   y xY w)Nr   r(   z[the 'overwrite_input' parameter is not supported in the pandas implementation of median\(\)rF   T)overwrite_input)r   r1   rP   rQ   r8   rj   s     r   test_validate_median_initialro      sE    
!Q.C	( 
 
z	- 	

4
( 
.	-	-s   AAc                      t        ddg      } d}t        j                  t        |      5  t	        j
                  | d       d d d        y # 1 sw Y   y xY w)Nr   r(   zQthe 'keepdims' parameter is not supported in the pandas implementation of sum\(\)rF   T)r]   ri   rj   s     r   test_validate_stat_keepdimsrq      sC    
!Q.C	% 
 
z	-
sT" 
.	-	-rl   c                    t        ddg      }|r7d}t        j                  t        |      5  |j	                          d d d        n|j	                         dk(  sJ d}t        j                  t        |      5  |j                          d d d        |j                         }| sd}t        j                  t        |      5  |j                          d d d        y # 1 sw Y   xY w# 1 sw Y   ^xY w# 1 sw Y   y xY w)N12zdoes not supportrF   12z9Could not convert string '12' to numeric|does not supportz6Could not convert \['12'\] to numeric|does not support)r   r1   rP   	TypeErrorr=   rI   to_frame)using_array_managerusing_infer_stringr   rR   dfs        r   (test_mean_with_convertible_string_raisesr{      s    
#s
C ]]9C0GGI 10 wwyD   
EC	y	,
 
- 
BG	y	,
	 
-	, 10
 
-	, 
-	,s#   C9C'C3C$'C03C<c                    t        j                  dddg      }| rd}nd}t        j                  t        |      5  |j                          d d d        t        j                  t        |      5  |j                  d       d d d        d}t        j                  t        |      5  |d	   j                          d d d        d
}t        j                  t        |      5  t        j
                  |d	   j                  d      j                         d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   yxY w# 1 sw Y   y xY w)NJ{   )dbnumericz'Could not convert string 'J' to numericz5Could not convert \['J'\] to numeric|does not supportrF   rI   z8Could not convert string 'J' to numeric|does not supportr   z6Could not convert string 'J' to numeric|ufunc 'divide'r	   )
r   	DataFramer1   rP   rv   rI   aggrM   astypearray)rx   rz   rR   s      r   #test_mean_dont_convert_j_to_complexr      s    	cc23	4B7F	y	,
	 
- 
y	,
v 
- EC	y	,
4 
-
BC	y	,
4)//0 
-	, 
-	, 
-	, 
-	, 
-	,s/   D0D''D3 2D?D$'D03D<?Ec                 J   d}t        g d      }t        j                  t        |      5  |j	                          d d d        | sd}|j                         }t        j                  t        |      5  |j	                          d d d        y # 1 sw Y   RxY w# 1 sw Y   y xY w)Nz:Cannot convert \['1' '2' '3'\] to numeric|does not support)rs   rt   3rF   z>Cannot convert \[\['1' '2' '3'\]\] to numeric|does not support)r   r1   rP   rv   r8   rw   )rx   rR   r   rz   s       r   *test_median_with_convertible_string_raisesr      ss    
GC

!C	y	,

 
- O	B	y	,
		 
-	, 
-	, 
-	,s   B3BBB")numpyrM   r1   pandasr   r   pandas._testing_testingr!   markparametrizer   r%   r.   r5   r:   r@   rU   rZ   anyallr3   re   rk   ro   rq   r{   r   r    r   r   <module>r      s&        .|0LM+ N+ tUm4% 5%-,- D%=1% 2%2* "&&"&&!12Z$68I#JK L 3 
)#(1*r   