
    bMhv                        d dl Zd dlZd dlZd dlmZ d dlmZ ej	        
                    dddg          d             Zej	        
                    ddd	g          d
             Zd Zd Zd Zej	        
                    ddd	g          d             Zd Zd Zej	        
                    dej        ej        g          ej	        
                    dddid e            ig          d                         Zd Zd Zd Zd Zd Zd ZdS )    N)Serieszoperation, expected)mina)maxbc                 l    t          ddgd          } t          ||                       }||k    sJ d S )Nr   r   stringdtype)r   getattr)	operationexpectedserres_operation_series       c/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pandas/tests/series/test_reductions.pytest_reductions_series_stringsr   	   sI     #s8
,
,
,C1'#y1133(******    	as_periodTFc                 8   t          d t          dd          D                       }| r|j                            d          }n|j                            d          }|                                }|j        |j        k    sJ t          j        ||           d S )Nc                 :    g | ]}t          j        d d|          S )i     )pd	Timestamp).0ns     r   
<listcomp>z-test_mode_extension_dtype.<locals>.<listcomp>   s&    @@@q",tQ**@@@r         Dz
US/Central)	r   rangedt	to_periodtz_localizemoder   tmassert_series_equal)r   r   ress      r   test_mode_extension_dtyper(      s     @@E!QKK@@@
A
AC /fs##f  ..
((**C9	!!!!3$$$$$r   c           	         t          dddt          j        ddt          j        g|           }|                    d          }t          ddt          j        g|           }t	          j        ||           |                    d          }t          ddg|           }t	          j        ||           t          j        |d<   |                    d          }t          ddg|           }t	          j        ||           |                    d          }t          t          j        g|           }t	          j        ||           d S )	Nr         r
   F)dropnaT)r   r   NAr$   r%   r&   )any_numeric_ea_dtyper   resultr   s       r   test_mode_nullable_dtyper1       s1   
!Q25!Q.6J
K
K
KCXXUX##Fq!RUm+?@@@H68,,,XXTX""Fq!f$8999H68,,,eCGXXTX""Fq!f$8999H68,,,XXUX##Frug%9:::H68,,,,,r   c                  :   t          j        d           t          ddgt                    } t	          j        dd          5  |                                 }d d d            n# 1 swxY w Y   t          ddgt                    }t          j        ||           d S )Npyarrowr   r   r
   zfuture.infer_stringT)	pytestimportorskipr   objectr   option_contextr$   r%   r&   )r   r0   r   s      r   test_mode_infer_stringr8   6   s    
	"""
#s6
*
*
*C		0$	7	7                sCj///H68,,,,,s   A##A'*A'c                      t          dt          j        gd          } | d         }|                                 |k    sJ |                                 |k    sJ |                                 |k    sJ d S )Nr   zm8[ns]r
   )r   r   NaTmedianr   r   )r   exps     r   test_reductions_td64_with_natr=   @   st    
!RVH
-
-
-C
a&C::<<377997799r   skipnac                     t          g d          }|                    |           }t          |t          j                  sJ |t          j        d          k    sJ d S )Nztimedelta64[ns]r
   )r>   r   )r   sum
isinstancer   	Timedelta)r>   r   r0   s      r   test_td64_sum_emptyrC   I   sa     ,
-
-
-CWWFW##Ffbl+++++R\!__$$$$$$r   c                     t          t          j        ddd                    } | dxx         t          j        d          z  cc<   | |                                 z
                                  }t          j        t          j        | |                                 z
            j        t          |           z  	                                          }t          j        |j        dz  |j        dz            sJ d}t          j        t          |	          5  | |                                 z
  	                                 d d d            n# 1 swxY w Y   | dd
         }t          j        t          |	          5  ||                                z
  	                                 d d d            n# 1 swxY w Y   | dd         }||                                z
  	                                 d S )N20130101i h)periodsfreqr   z1s 1msi  zoverflow in timedelta operationmatchi'  )r   r   
date_rangerB   r   meanTimedeltaIndexasi8lenr@   npallclose_valuer4   raises
ValueError)r   r0   r   msgs1s2s         r   test_td64_summation_overflowrX   S   s   
z6DDD
E
ECFFFbl8$$$FFF CGGIIo##%%F|R.sSWWYY??Ds3xxOTTVVWWH ;v}t+X_t-CDDDDD ,C	z	-	-	-    	swwyy                              
QuWB	z	-	-	-  	bffhh              	QtVB"&&((]s$   *EEE<*F22F69F6c                      t          g dt          d                    } |                                 }t          |t                     rJ d S )N)      ?rZ   rZ   r*   )index)r   r    prodrA   )r   r0   s     r   test_prod_numpy16_bugr]   l   sG    
a
1
1
1CXXZZF&&)))))))r   funckwargskeepdimsoutc                     t          ddg          }t          t          |                     }|j        }d| d| d}t	          j        t          |          5   ||fi |  d d d            d S # 1 swxY w Y   d S )Nr   r+   zthe 'z=' parameter is not supported in the pandas implementation of z\(\)rI   )r   nextiter__name__r4   rS   rT   )r_   r^   r   paramnamerU   s         r   )test_validate_any_all_out_keepdims_raisesrh   s   s     !Q..CfE=D	) 	) 	)"	) 	) 	) 
 
z	-	-	-  SF                 s   
A00A47A4c                      t          ddg          } d}t          j        t          |          5  t	          j        | d           d d d            d S # 1 swxY w Y   d S )Nr   r+   zPthe 'initial' parameter is not supported in the pandas implementation of sum\(\)rI   
   )initialr   r4   rS   rT   rP   r@   r   rU   s     r   test_validate_sum_initialrn      s    
!Q..C	% 
 
z	-	-	-    
sB                                      AAAc                      t          ddg          } d}t          j        t          |          5  |                     d           d d d            d S # 1 swxY w Y   d S )Nr   r+   z[the 'overwrite_input' parameter is not supported in the pandas implementation of median\(\)rI   T)overwrite_input)r   r4   rS   rT   r;   rm   s     r   test_validate_median_initialrr      s    
!Q..C	( 
 
z	-	-	- ) ) 	

4
((() ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )ro   c                      t          ddg          } d}t          j        t          |          5  t	          j        | d           d d d            d S # 1 swxY w Y   d S )Nr   r+   zQthe 'keepdims' parameter is not supported in the pandas implementation of sum\(\)rI   T)r`   rl   rm   s     r   test_validate_stat_keepdimsrt      s    
!Q..C	% 
 
z	-	-	- # #
sT""""# # # # # # # # # # # # # # # # # #ro   c                    t          ddg          }|                                dk    sJ d}t          j        t          |          5  |                                 d d d            n# 1 swxY w Y   |                                }| sd}t          j        t          |          5  |                                 d d d            d S # 1 swxY w Y   d S )N1212zHCould not convert string '12' to numeric|does not support|Cannot performrI   zECould not convert \['12'\] to numeric|does not support|Cannot perform)r   r@   r4   rS   	TypeErrorrL   to_frame)using_array_managerusing_infer_stringr   rU   dfs        r   (test_mean_with_convertible_string_raisesr~      sK   
#s

C7799
TC	y	,	,	,  


               
B WV	y	,	,	,  
			                 s$   	A**A.1A.(C

CCc                    t          j        dddg          }| rd}nd}t          j        t          |          5  |                                 d d d            n# 1 swxY w Y   t          j        t          |          5  |                    d           d d d            n# 1 swxY w Y   d}t          j        t          |          5  |d	                                          d d d            n# 1 swxY w Y   d
}t          j        t          |          5  t          j        |d	                             d          j	                   d d d            d S # 1 swxY w Y   d S )NJ{   )dbnumericz'Could not convert string 'J' to numericzDCould not convert \['J'\] to numeric|does not support|Cannot performrI   rL   zGCould not convert string 'J' to numeric|does not support|Cannot performr   zECould not convert string 'J' to numeric|ufunc 'divide'|Cannot performr	   )
r   	DataFramer4   rS   ry   rL   aggrP   astypearray)r{   r}   rU   s      r   #test_mean_dont_convert_j_to_complexr      sG   	cc223	4	4B V7U	y	,	,	,  
			               
y	,	,	,  
v               TC	y	,	,	,  
4              
QC	y	,	,	, 1 1
4))/0001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1sG   AA #A B$$B(+B(C33C7:C73EE"Ec                 z   d}t          g d          }t          j        t          |          5  |                                 d d d            n# 1 swxY w Y   | sd}|                                }t          j        t          |          5  |                                 d d d            d S # 1 swxY w Y   d S )NzICannot convert \['1' '2' '3'\] to numeric|does not support|Cannot perform)rv   rw   3rI   zMCannot convert \[\['1' '2' '3'\]\] to numeric|does not support|Cannot perform)r   r4   rS   ry   r;   rz   )r{   rU   r   r}   s       r   *test_median_with_convertible_string_raisesr      s8   
VC

!
!C	y	,	,	,  

                
 	 
B	y	,	,	,  
		                 s#   AAAB00B47B4)numpyrP   r4   pandasr   r   pandas._testing_testingr%   markparametrizer   r(   r1   r8   r=   rC   rX   r]   anyallr6   rh   rn   rr   rt   r~   r   r    r   r   <module>r      s                        .|0LMM+ + NM+ tUm44% % 54%- - -,- - -   D%=11% % 21%  2* * * "&"&!122Z$68I#JKK  LK 32     
) 
) 
)# # #   1 1 1*    r   