
    PiJ                     p    d dl m Z  d dlZd dlmZ d dlZd dlmZmZm	Z	m
Z
mZ d dlmZ  G d d          ZdS )    )datetimeN)Pandas4Warning)PeriodSeries
date_rangeperiod_rangeto_datetimec                   J    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 ZdS )TestCombineFirstc           
         t          ddd          }t          t          d          t          d          d          }||fD ]}t          dt          j        t          j        d	d
t          j        dg|          }t          g d|          }|                    |          }t          g d|t          j                  }t          j	        ||           d S )Nz
1950-01-31z
1950-07-31ME)startendfreqz1950-1z1950-7M            index)	   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   dtype)
r   r   r   r   npnancombine_firstfloat64tmassert_series_equal)selfdidxpidxidxabresultexpecteds           /home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/pandas/tests/series/methods/test_combine_first.py"test_combine_first_period_datetimez3TestCombineFirst.test_combine_first_period_datetime   s    ,TJJJ&"2"2x8H8HsSSS$< 	5 	5C26261a;3GGGA,,,C888A__Q''F3333bjQQQH"684444	5 	5    c                 d    |                     |d d                   }|j        |j        k    sJ d S )Nr   )r   name)r!   datetime_seriesr'   s      r)   test_combine_first_namez(TestCombineFirst.test_combine_first_name    s:     ..rr/BCC{o2222222r+   c                    t          j        dt           j                  }t          |t          j        dt           j                            }|dz  }t           j        |d d d<   |                    |          }t          j        ||           |                    |          }t          j	        |          
                                sJ t          j        |d d d         |d d d                    t          j        |dd d         |dd d                    t          j        d t          d          D                       }t          t           j                            d                              d          |          }t          d t          d          D             |d d d         t"          	          }|                    |          }t          j        ||j        |d d d                             t          j        |dd d                             t"                    |j        |dd d                             t          g d
g d          }	t          g g t"          	          }
|	                    |
          }|s|	j                            d          |	_        t          j        ||	                    t"                               d S )N   r   r      r   c                 ,    g | ]}t          |          S  str.0is     r)   
<listcomp>z7TestCombineFirst.test_combine_first.<locals>.<listcomp>8       444Q#a&&444r+   c                 ,    g | ]}t          |          S r5   r6   r8   s     r)   r;   z7TestCombineFirst.test_combine_first.<locals>.<listcomp>:   r<   r+   
   r   )      ?r3      )r   r   r3   O)r   aranger   r   int64r   r   r   r    isfiniteallpdIndexrangerandomdefault_rngstandard_normalobjectlocastyper   )r!   using_infer_stringvaluesseriesseries_copycombinedr   floatsstringsseremptyr'   s               r)   test_combine_firstz#TestCombineFirst.test_combine_first$   s   2RZ000bi"(&C&C&CDDDqj6CCaC ''44
x000 ,,V44{8$$((*****
x!}fSSqSk:::
x1~{14a4/@AAA 44%))44455	--a00@@DDERRR44%))444E##A#JfUUU((00
wU33Q3Z(@AAA
vadd|226::HLqtRSt<UVVV [[[			222r6222""5))! 	.	((--CI
vszz&'9'9:::::r+   c                    t          t          dt          j        g                    j                            |          }t          t          t          j        dg                    j                            |          }|                    |          }t          t          ddg                    j                            |          }t          j        ||           d S )N20102011)	r	   r   r   r   dtas_unitr   r   r    )r!   units0s1rsxps         r)   test_combine_first_dt64z(TestCombineFirst.test_combine_first_dt64I   s     011225==dCC 011225==dCCb!! 011225==dCC
r2&&&&&r+   c                    t          t          dt          j        g                    j                            |          }t          t          j        dg          }d}t          j        t          |          5  |	                    |          }d d d            n# 1 swxY w Y   t          t          ddd          dgd| d	          }|d
v r|j                            d          }t          j        ||           d S )NrZ   r[   z1Silently casting non-datetime 'other' to datetime)matchi  r   zdatetime64[]r2   )smsus)r	   r   r   r   r\   r]   r   assert_produces_warningr   r   r   r    )r!   r^   r_   r`   msgra   rb   s          r)   +test_combine_first_dt64_casting_deprecationz<TestCombineFirst.test_combine_first_dt64_casting_deprecationP   s.    011225==dCCRVV$%%A'cBBB 	& 	&!!"%%B	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& XdAq))62:O:O:O:OPPP;t$$B
r2&&&&&s   9BB"Bc                 N   t          t          j        g d|          d          }t          t          j        g d|          g dd          }|                    |          }t          j        g d	|          }t          |d          }t	          j        ||           d S )
N)201501012015010220150103tzser1)r-   )201605142016051520160516)r3   r@   r   ser2)r   r-   )rn   ro   rp   ru   rv   )r   rF   DatetimeIndexr   r   r    )r!   tz_naive_fixturers   rw   r'   exp_valsexps          r)   test_combine_first_dt_tz_valuesz0TestCombineFirst.test_combine_first_dt_tz_values_   s    AAAFVWWW
 
 
 AAAFVWWW))
 
 

 ##D))#HHH
 
 
 XF+++
sF+++++r+   c           	      V   t          t          dddd          t          dddd          dd          }t          t          d          |          }t          |          }|                    |          }t          j        ||                    t          j	                             d S )Ni  r   r>   hzEurope/Rome)r   rr   r   )
r   r   r   rH   r   r   r    rN   r   r   )r!   
time_indexr`   s2r'   s        r)   4test_combine_first_timezone_series_with_empty_serieszETestCombineFirst.test_combine_first_timezone_series_with_empty_seriesq   s    T1a##T1a$$	
 
 

 E"IIZ000*%%%!!"%%
vryy'<'<=====r+   c                     t          ddg          }t          g d          }|                    |          }t          g d          }t          j        ||           d S )N   +YNJ9    M,YNJ9 )r   r3   r@   )r   r   r@   r   r   r   r    r!   r`   r   r'   r(   s        r)   "test_combine_first_preserves_dtypez3TestCombineFirst.test_combine_first_preserves_dtype~   sg    (*=>??III!!"%%GGGHH
vx00000r+   c           
         t          t          j        dd          di          }t          t          j        dd          dt          j        dd          d	i          }|                    |          }t          dd	gt          j        t          j        d
d          t          j        dd          gd                    }t          j        ||           d S )Nz
2019-05-01UTCrq   r?   z2019-05-01 01:00:00+0100zEurope/Londong       @z
2019-05-02g      @z2019-05-01 00:00:00+00:00z2019-05-02 00:00:00+00:00rL   r2   r   )r   rF   	Timestampr   rG   r   r    )r!   
uniform_tzmulti_tzr'   r(   s        r)   test_combine_mixed_timezonez,TestCombineFirst.test_combine_mixed_timezone   s    R\,5AAA3GHH
7OLLLc\e444c
 
 ))(33#J(L!<GGGL!<GGG   	
 	
 	
 	vx00000r+   c                     t          g dg d          }t          g dg d          }|                    |          }t          d gdz  g d          }t          j        ||           d S )N)NNN)r%   r&   cr   )r&   r   dr   )r%   r&   r   r   r   r   s        r)   test_combine_first_none_not_nanz0TestCombineFirst.test_combine_first_none_not_nan   s    &&&ooo>>>&&&ooo>>>!!"%%4&1*,@,@,@AAA
vx00000r+   N)__name__
__module____qualname__r*   r/   rX   rc   rl   r|   r   r   r   r   r5   r+   r)   r   r      s        5 5 53 3 3#; #; #;J' ' '' ' ', , ,$> > >1 1 11 1 1.1 1 1 1 1r+   r   )r   numpyr   pandas.errorsr   pandasrF   r   r   r   r   r	   pandas._testing_testingr   r   r5   r+   r)   <module>r      s              ( ( ( ( ( (                       R1 R1 R1 R1 R1 R1 R1 R1 R1 R1r+   