
    bMh>                    n   d Z ddlZddlmZ ddlmZmZmZm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ZddlZddlmZ dd	lmZmZ dd
lmZmZ ddlmc 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*m+Z+ ddl,m-Z. ddl/m0Z0 ddl1m2Z3 ddl4m5Z5 dZ6ej7        8                    d          Z9 ej:        ddg          d             Z; G d d          Z< G d d          Z= G d d          Z> G d d          Z? G d d          Z@ G d  d!          ZA G d" d#          ZB G d$ d%          ZC G d& d'          ZD ej:        g d(          d)             ZEej:        d*             ZFej:        d+             ZG ej:        g d,          d-             ZHej:        d.             ZI G d/ d0          ZJ G d1 d2          ZKd3 ZLej7        M                    d4ejN        eOg          d5             ZPej7        M                    d6g d7          ej7        M                    d8g d9d:fg d;d<fgd=d>g?          d@                         ZQdA ZRej7        M                    dBddg          dC             ZSej7        M                    dDdEe5e5dFz   e5dGz   g          dH             ZTdI ZUdJ ZVdK ZWej7        M                    dLddg          ej7        M                    dMd>dNg          dO                         ZXdP ZYej7        M                    dQdR e$dSe&g          fdT e%dUdVgdWX          fg          dY             ZZdZ Z[d[ Z\d\ Z]d] Z^d^ Z_d_ Z`d`Za e(ea          Zbej7        8                    da          ej7        M                    dbea e(ea          gdc ?          ej7        M                    ddeadde         ebc                    d          eb                                ebjd        ebje         efebje                  gdf ?          ej7        M                    dgddg          dh                                                 ZgdS )iz test to_datetime     N)deque)datedatetime	timedeltatimezone)Decimalparse)tzoffset)tslib)iNaTparsing)OutOfBoundsDatetimeOutOfBoundsTimedelta)is_datetime64_ns_dtype)		DataFrameDatetimeIndexIndexNaTSeries	Timestamp
date_rangeisnato_datetime)DatetimeArray)	datetimes)start_caching_ata_  You might want to try:\n    - passing `format` if your strings have a consistent format;\n    - passing `format=\'ISO8601\'` if your strings are all ISO8601 but not necessarily in exactly the same format;\n    - passing `format=\'mixed\'`, and the format will be inferred for each element individually. You might want to use `dayfirst` alongside this.z2ignore:errors='ignore' is deprecated:FutureWarningTF)paramsc                     | j         S )z/
    cache keyword to pass to to_datetime.
    paramrequests    c/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pandas/tests/tools/test_to_datetime.pycacher%   A   s    
 =    c                      e Zd Zej                            dddg          d             Zej                            dd ed           ed           ed	          ggd
 ed           ed           ed          ggg          d             Zej                            dg dg dg dg dg dg dg          d             Z	d Z
d Zd Zd Zd Zd Zej                            dg dddej        gddegg d g d!d"d#ej        gd"d#egg d$g          d%             Zej                            d& edej        d'd(g           e ed          ej        ej        ej        g          g edd'd(ej        g           e ed          ej        ej        ej        g          g ed)ej        d*d+g           e ed,          ej        ej        ej        g          g ed)d*ej        d+g           e ed,          ej        ej        ej        g          gg          d-             Zej                            d.ej        gd/ ed0g          fej        gd1 ed0g          fej        d2gd/ ed0d3g          fd4ej        gd5 ed6d0g          fd4ej        gd7 ed8d0g          fd1ej        ej        gd1 eg d9          fd1ej        ej        gd: eg d9          fg          d;             Zd< Zd= Zej                            d>d? ed@dAdB          gdC edDdEdF          gdGdGgdHdHgdIdIgdJdJgg          dK             ZdL Zej                            dMdNdO edP          gdQdR edS          gdTdU edV          g ej        dWdX edY          ej                              e!j"                    dZ         d[v d\d]          ^           ej        d_dX ed`          ej                              e!j"                    dZ         d[v d\d]          ^           ej        dadb edc          ej                              e!j"                    dZ         d[v d\d]          ^          g          dd             Z#e$j%        de             Z&ej                            ddf edgdhdE          fdi edgdEdh          fdj edgdhdEdk          fdl edgdEdhdk          fdm edgdhdEdkdn          fdo edgdEdhdkdn          fdp edgdhdEdkdndq          fdr edgdEdhdkdndq          fds edgdhdEdkdndqdt          fdu edgdEdhdkdndqdt          fdv edgdhdEdkdndqdtdwx          fdy edgdEdhdkdndqdtdwx          fg          dz             Z'ej                            d{g d|          d}             Z(ej                            d~dd ed          gdd ed          gg          d             Z)ej                            dddgdz   eddx          gdz  gddgdz   ed e* e+d                              gdz  gddgdz   ed e* e+d                              gdz  gdddg ed e,j-        dZ                     ed e,j-        dZ                    ggg          d             Z.ej                            ddg d eddx           eddx           eddx          ggdddg ed e* e+d                               ed e* e+d                              ggg          d             Z/d Z0ej                            dg d          d             Z1d Z2d1S )TestTimeConversionFormatsreadonlyTFc                     t          j        g t                    }|r|                    d           t	          |          }t	          g           }t          j        ||           d S )NdtypeF)write)nparrayobjectsetflagsr   tmassert_index_equal)selfr)   arrresultexpecteds        r$   test_to_datetime_readonlyz3TestTimeConversionFormats.test_to_datetime_readonlyJ   se     hr((( 	&LLuL%%%S!!r??
fh/////r&   zformat, expected%d/%m/%Y200001012000020120000301%m/%d/%Y2000010220000103c                      |g d          }t          |||          } ||          }t          j        ||           d S )N)1/1/20001/2/20001/3/2000formatr%   )r   r2   assert_equal)r4   r%   index_or_seriesrE   r7   valuesr6   s          r$   test_to_datetime_formatz1TestTimeConversionFormats.test_to_datetime_formatT   sU     !!E!E!EFFVF%@@@"?8,,
)))))r&   zarg, expected, format)rA   r:   r9   )rA   r:   r=   )rB   r;   r9   )rB   r>   r=   )rC   r<   r9   )rC   r?   r=   c                 X    t          |||          }t          |          }||k    sJ d S NrD   r   r   )r4   r%   argr7   rE   r6   s         r$   test_to_datetime_format_scalarz8TestTimeConversionFormats.test_to_datetime_format_scalarg   s<     Su===X&&!!!!!!r&   c                 d   t          ddgdgdz  z             }t          d |                    t                    D                       }t          |d|          }t	          j        ||           t          |                    t                    d|          }t	          j        ||           d S )N$.9G.   c                 ,    g | ]}t          |          S  r   .0xs     r$   
<listcomp>zNTestTimeConversionFormats.test_to_datetime_format_YYYYMMDD.<locals>.<listcomp>y       @@@A9Q<<@@@r&   %Y%m%drD   r   applystrr   r2   assert_series_equalr4   r%   serr7   r6   s        r$    test_to_datetime_format_YYYYMMDDz:TestTimeConversionFormats.test_to_datetime_format_YYYYMMDDw   s    h)XJN:;;@@3@@@AAS???
vx000SYYs^^HEJJJ
vx00000r&   c                    t          ddgdgdz  z   d          }t          t          d          t          d          gt          d          gdz  z             }t          j        |d<   t          j        |d<   t	          |d	|
          }t          j        ||           |                    t                    }d|d<   t          j
        t          d          5  t	          |d	|
           d d d            d S # 1 swxY w Y   d S )NrP   rQ   rR   floatr+   1980122219810105   r[   rD   natzOunconverted data remains when parsing with format "%Y%m%d": ".0", at position 0match)r   r   r.   nanr   r2   r_   r]   r^   pytestraises
ValueError)r4   r%   ra   r7   r6   ser2s         r$   )test_to_datetime_format_YYYYMMDD_with_natzCTestTimeConversionFormats.test_to_datetime_format_YYYYMMDD_with_nat   sT   h)XJN:'JJJz""Ij$9$9:i
>S>S=TWX=XX
 
 fAS???
vx000 yy~~Q] 
 
 
 	< 	< XU;;;;	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	<s   C99C= C=c                 B   t          ddgdgdz  z   d          }t          t          d          t          d          gt          d          gdz  z             }t          j        |d<   t          j        |d<   t	          |d	|
          }t          j        ||           d S )Ni| i rR   rd   r+   1980120119810101rg   %Y%mrD   )r   r   r.   rk   r   r2   r_   r`   s        r$   'test_to_datetime_format_YYYYMM_with_natzATestTimeConversionFormats.test_to_datetime_format_YYYYMM_with_nat   s     ff%14GDDDz""Ij$9$9:i
>S>S=TWX=XX
 
 fASu===
vx00000r&   c                     t          g d          }t          |dd|          }t          g dt                    }t          j        ||           d S )Ni3iT3ir[   ignorerE   errorsr%   r+   )r   r   r0   r2   r_   r4   r%   ra   r6   r7   s        r$   'test_to_datetime_format_YYYYMMDD_ignorezATestTimeConversionFormats.test_to_datetime_format_YYYYMMDD_ignore   si     33344S(%PPP***
 
 
 	vx00000r&   c                     t          ddt          j        gdd|          }t          ddt          j        gt                    }t          j        ||           d S )N1501010120150101r[   rx   ry   r+   )r   r.   rk   r   r0   r2   r3   r4   r%   r6   r7   s       r$   8test_to_datetime_format_YYYYMMDD_ignore_with_outofboundszRTestTimeConversionFormats.test_to_datetime_format_YYYYMMDD_ignore_with_outofbounds   sa    RV,	
 
 
 *j"&9HHH
fh/////r&   c                     t          g d          }t          |dd|          }t          g dd          }t          j        ||           d S )Nrw   r[   coercery   )2012123120141231r   M8[ns]r+   r   r   r2   r_   r{   s        r$   )test_to_datetime_format_YYYYMMDD_coercionzCTestTimeConversionFormats.test_to_datetime_format_YYYYMMDD_coercion   s`     33344S(%PPP999JJJ
vx00000r&   input_s)re   20010112Nre   r   )re   r   r   )rP   T1NrP   r   )rP   r   r   c                     t          t          d          t          d          t          g          }t          t          |d                    }t	          j        ||           d S )Nre   r   r[   rE   )r   r   r   r   r2   r_   r4   r   r7   r6   s       r$   *test_to_datetime_format_YYYYMMDD_with_nonezDTestTimeConversionFormats.test_to_datetime_format_YYYYMMDD_with_none   s[    & 9Z00)J2G2GMNNGH===>>
vx00000r&   zinput_s, expected2001001210019999i]4iT1i{120190813c                 T    t          |dd          }t          j        ||           d S )Nr[   r   rE   rz   )r   r2   r_   r   s       r$   )test_to_datetime_format_YYYYMMDD_overflowzCTestTimeConversionFormats.test_to_datetime_format_YYYYMMDD_overflow   s1    8 WXhGGG
vx00000r&   zdata, format, expectedz%Y%m%d%H%M%Sr   N20210202202020z2021-02-02 20:20:20201010z%y%m%dz
2020-10-10z%d%m%y
2010-10-20)r   r   r   r[   c                 R    t          ||          }t          j        ||           d S Nr   r   r2   r3   )r4   datarE   r7   r6   s        r$   test_to_datetime_with_NAz2TestTimeConversionFormats.test_to_datetime_with_NA   s/    $ T&111
fh/////r&   c                     t          dt          j        g          }t          ddg          }t	          j        ||           d S )Nr   r   r   )r   pdNAr   r2   r3   r4   r6   r7   s      r$   %test_to_datetime_with_NA_with_warningz?TestTimeConversionFormats.test_to_datetime_with_NA_with_warning  sA    h.// ,!677
fh/////r&   c                    t          g d          }t          d |                    t                    D                       }t          |d|          }t	          j        ||           t          g d          }t          d |                    t                    D                       }t          |d|          }t	          j        ||           d S )N)    i  c                 ,    g | ]}t          |          S rT   rU   rV   s     r$   rY   zMTestTimeConversionFormats.test_to_datetime_format_integer.<locals>.<listcomp>  rZ   r&   z%YrD   )iA i i c                 X    g | ]'}t          |d d         dz   |dd          z             (S )N   -rU   rV   s     r$   rY   zMTestTimeConversionFormats.test_to_datetime_format_integer.<locals>.<listcomp>  s9    RRRa9QrrUS[1QRR5%899RRRr&   rt   r\   r`   s        r$   test_to_datetime_format_integerz9TestTimeConversionFormats.test_to_datetime_format_integer  s    '''((@@3@@@AASU;;;
vx000---..RR399S>>RRRSSSu===
vx00000r&   zint_date, expectedi3  
      i i     r   iuwi(3iA iI  c                 :    t          |dd          }||k    sJ d S )Nr[   rx   r   r   )r4   int_dater7   r6   s       r$   .test_int_to_datetime_format_YYYYMMDD_typeerrorzHTestTimeConversionFormats.test_int_to_datetime_format_YYYYMMDD_typeerror$  s/    & XhxHHH!!!!!!r&   c                     t           j        d         }d| d}d}t          |||          }t          j        ||          }||k    sJ d S )Nr   z01-z-2011 00:00:01.978z%d-%b-%Y %H:%M:%S.%frD   )calendar
month_abbrr   r   strptime)r4   r%   r   valrE   r6   exps          r$   #test_to_datetime_format_microsecondz=TestTimeConversionFormats.test_to_datetime_format_microsecond:  s[    (+
2J222'Su===V,,}}}}}}r&   zvalue, format, dtz01/10/2010 15:20z%m/%d/%Y %H:%Mz2010-01-10 15:20z01/10/2010 05:43z%m/%d/%Y %I:%Mz2010-01-10 05:43z01/10/2010 13:56:01z%m/%d/%Y %H:%M:%Sz2010-01-10 13:56:01z01/10/2010 08:14 PMz%m/%d/%Y %I:%M %pz2010-01-10 20:14r   )zh_CNit_ITz4fail on a CI build with LC_ALL=zh_CN.utf8/it_IT.utf8)reasonstrict)marksz01/10/2010 07:40 AMz2010-01-10 07:40z01/10/2010 09:12:56 AMz%m/%d/%Y %I:%M:%S %pz2010-01-10 09:12:56c                 6    t          |||          |k    sJ d S rK   r   )r4   r%   valuerE   dts        r$   test_to_datetime_format_timez6TestTimeConversionFormats.test_to_datetime_format_timeC  s+    Z 5u===CCCCCCr&   c                     t          g d          }t          |dd|          }t          |j                            dd          d|          }t	          j        ||           d S )N)19MAY11foobar19MAY11z19MAY11:00:00:00z19MAY11 00:00:00Zz%d%b%yF)rE   exactr%   z(\d+\w+\d+))expandrD   )r   r   r^   extractr2   r_   r{   s        r$   test_to_datetime_with_non_exactz9TestTimeConversionFormats.test_to_datetime_with_non_exactr  s}    
 QQQ
 
 SeLLLGOON5O99(RW
 
 
 	vx00000r&   %Y-%m-%dr      %Y-%d-%m%Y-%m-%d %H   z%Y-%d-%m %H%Y-%m-%d %H:%M"   z%Y-%d-%m %H:%M%Y-%m-%d %H:%M:%S8   %Y-%d-%m %H:%M:%S%Y-%m-%d %H:%M:%S.%f@ z%Y-%d-%m %H:%M:%S.%f%Y-%m-%d %H:%M:%S.%f%z	UTC+01:00tzz%Y-%d-%m %H:%M:%S.%f%zc                 :    t          d|d          }||k    sJ d S )Nz 2000-01-03 12:34:56.123456+01:00FrE   r   r   )r4   r%   rE   r7   r6   s        r$   (test_non_exact_doesnt_parse_whole_stringzBTestTimeConversionFormats.test_non_exact_doesnt_parse_whole_string  s8    4 .vU
 
 
 !!!!!!r&   rM   )z2012-01-01 09:00:00.000000001z2012-01-01 09:00:00.000001z2012-01-01 09:00:00.001z2012-01-01 09:00:00.001000z2012-01-01 09:00:00.001000000c                 \    t          ||          }t          |d|          }||k    sJ d S )Nr%   r   rD   r   )r4   r%   rM   r7   r6   s        r$   #test_parse_nanoseconds_with_formulaz=TestTimeConversionFormats.test_parse_nanoseconds_with_formula  sB     s%000S)?uMMM!!!!!!r&   zvalue,fmt,expected2009324z%Y%W%wz
2009-08-132013020z%Y%U%wz
2013-01-13c                 6    t          |||          |k    sJ d S rK   r   )r4   r   fmtr7   r%   s        r$   test_to_datetime_format_weeksz7TestTimeConversionFormats.test_to_datetime_format_weeks  s*     5E:::hFFFFFFr&   zfmt,dates,expected_datesz%Y-%m-%d %H:%M:%S %Z2010-01-01 12:00:00 UTCrg   2010-01-01 12:00:00UTC%Y-%m-%d %H:%M:%S%zz2010-01-01 12:00:00+0100<   minutestzinfo%Y-%m-%d %H:%M:%S %z2010-01-01 12:00:00 +01002010-01-01 12:00:00 Zc                 p    t          ||          }t          |          }t          j        ||           d S r   )r   r   r2   rF   )r4   r   datesexpected_datesr6   r7   s         r$   )test_to_datetime_parse_tzname_or_tzoffsetzCTestTimeConversionFormats.test_to_datetime_parse_tzname_or_tzoffset  s<    T U3///((
)))))r&   )r   z2010-01-01 12:00:00 GMTz2010-01-01 12:00:00 US/PacificGMT
US/Pacific2010-01-01 12:00:00 -0100c                     d}t          j        t          |          5  t          ||          }d d d            n# 1 swxY w Y   t	          |          }t          j        ||           d S )N;parsing datetimes with mixed time zones will raise an errorri   r   )r2   assert_produces_warningFutureWarningr   r   rF   )r4   r   r   r   msgr6   r7   s          r$   >test_to_datetime_parse_tzname_or_tzoffset_utc_false_deprecatedzXTestTimeConversionFormats.test_to_datetime_parse_tzname_or_tzoffset_utc_false_deprecated  s    D L'SAAA 	4 	4 s333F	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4((
)))))s   <A A c                     g d}g d}d}t          ||d          }t          |          }t          j        ||           d S )N)r   r   z2010-01-01 12:00:00 +0300z2010-01-01 12:00:00 +0400)z2010-01-01 11:00:00+00:00z2010-01-01 13:00:00+00:00z2010-01-01 09:00:00+00:00z2010-01-01 08:00:00+00:00r   TrE   utcr   r   r2   r3   )r4   r   r   r   r6   r7   s         r$   =test_to_datetime_parse_tzname_or_tzoffset_different_tz_to_utczWTestTimeConversionFormats.test_to_datetime_parse_tzname_or_tzoffset_different_tz_to_utc  se    
 
 

 
 
 %U3D999 00
fh/////r&   offset)z+0z-1fooUTCbarz:10z
+01:000:01 c                     d}d|z   }d                     dt           ddt           dg          }t          j        t          |          5  t          |g|           d d d            d S # 1 swxY w Y   d S )	Nr   z2010-01-01 12:00:00 |z;^time data ".*" doesn\'t match format ".*", at position 0. $N^unconverted data remains when parsing with format ".*": ".*", at position 0. ri   r   joinPARSING_ERR_MSGrl   rm   rn   r   )r4   r  r   r   r   s        r$   )test_to_datetime_parse_timezone_malformedzCTestTimeConversionFormats.test_to_datetime_parse_timezone_malformed$  s     %%.hh&"& & &5"15 5 5
 
 ]:S111 	, 	,s++++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,s   A,,A03A0c                     d}t          dgd          }t          ||          }t          dgdd          }t          j        ||           d S )	Nr   r   foonamer   r   r   )r   r  )r   r   r   r2   r3   )r4   r   rM   r6   r7   s        r$   *test_to_datetime_parse_timezone_keeps_namezDTestTimeConversionFormats.test_to_datetime_parse_timezone_keeps_name6  s`    $,-E:::S--- "7!8UOOO
fh/////r&   )3__name__
__module____qualname__rl   markparametrizer8   r   rI   rN   rb   rp   ru   r|   r   r   r.   rk   r   r   r   r   r   r   r   r   r   r   r   r   r   r!   xfaillocale	getlocaler   tdskip_if_not_us_localer   r   r   r   r   r   pytzFixedOffsetr   r   r  r  r  rT   r&   r$   r(   r(   I   s.       [Z$770 0 870 [ :&&		*(=(=yy?T?TU
 :&&		*(=(=yy?T?TU		
 * * * [000000000000000000	

 
" "
 
"
1 1 1< < <4
1 
1 
1	1 	1 	1	0 	0 	01 1 1 [ +**RV,S)+++&&&x(x%'''	
 1 1 1 [ 
BFJ
CDD		*--rvrvrvFGG 
J
BFCDD		*--rvrvrvFGG "&(H=>>		*--rvrvrvFGG (BFH=>>		*--rvrvrvFGG#	
 21 13 21 [ eWnmmUG&<&<=eWdMM5'223()u&;<==
 --u8M*N*NO--u8M*N*NOBFBE"D--8M8M8M*N*NOBFBE"Hmm<Q<Q<Q.R.RS	
  0 0!  0
0 0 01 1 1 [ xxb"--.XXdAq))*$x g4L	
 "" "# ""
   [!199=O3P3PQ!199=O3P3PQ%#	/00 FL%#	,--k''$F$&&q)-??Q  (  		 	 	 FL%#	,--k''$F$&&q)-??Q  (  		 	 	 FL(&	/00k''$F$&&q)-??Q  (  		 	 	=(	
+ +XD DY+ +XD 1 1 1 [4A../4A../IIdAq"556IIdAq"556yyq!R<<=yyq!R<<= ))D!QB"C"CD ))D!QB"C"CD#YYtQ2r2v%N%NO#YYtQ2r2v%N%NO(	$1b"b&[III
 )	$1b"b&[III	
 ." "/ ." [	
 	
 	
	 	" "	 	" [))L"9"9:))L"9"9:	
 G G G [" '*+a/0U;;;<q@ &+,q0I-hhyyQS?T?T?T6U6U  
 	 ',-1I-hhyyQS?T?T?T6U6U  
 	 '(*ABI-6Fd6Fq6I6I   I3<LD<LQ<O<OPPP		5$	
' 'P* *Q' 'P* [" '   I3>>>I3>>>I3EEE ',.IJI-hhyyQS?T?T?T6U6U   I-hhyyQT?U?U?U6V6V  		
 <* *= <*0 0 0( [DDD , , ,0 0 0 0 0r&   r(   c                      e Zd Zej                            d          d             Zd Zd Zej        	                    dddgdd	g
          d             Z
ej        	                    dddgddg
          ej        	                    d ej        dddg eddgd          d           ej        dddg eddg          d           ej        dddg eddgd          d           ej        dd dg eddgd          d!          g          ej        	                    d"ed# g          d$                                     Zej        	                    dddgddg
          ej        	                    d"ed% g          d&                         Zej        	                    d' ej        d e ed(d)*           ed+d,*          eg          d-           ej        d e ed(d)*           ed.d,*          eg          d/          g          d0             Zej        	                    d' ej        d eg d1d          d2           ej        d eg d3d          d4          g          d5             Zej        	                    dddgddg
          ej        	                    d6 ej        dd7gd8          g          ej        	                    d"ed9 g          d:                                     Zd; Zej        	                    d<d=d> ed?d@dAdBdB          gdCd> edDdEdEdBdB          gdFd> edDdEdGdBdB          gg          dH             Zej        	                    dIg dJg dKg dLg dMg dNg dOg dPg dQg dRg dSg dTg dUg dVg dWg dXg dYg dZg d[g d\g          ej        	                    d]g d^          d_                         Zej        	                    d`dadbg          dc             Zej        ej        	                    ddeeg          ej        	                    deddg          ej        	                    d`dadbg          df                                                 Zdg Zdh Zdi Z ej        dj             Z!ej        ej        	                    d`dkdlg          dm                         Z"ej        	                    dndodpg          dq             Z#ej        	                    drg ds          ej        	                    dtdudvg          dw                         Z$ej        	                    dx e%j&        dy           e%j&        dz          g          d{             Z'ej        	                    d|d}d~g          d             Z(ej        	                    dx e%j&        d           e%j&        d          g          ej        	                    d]g d          d                         Z)ej        j*        d             Z+ej        	                    dddg          d             Z,d Z-d Z.d Z/d Z0d Z1d Z2ej        	                    deefe3efe%j4        efeefg          d             Z5ej        	                    dd edde*          gd edde*          gg          d             Z6d Z7d Z8ej        	                    dddg          d             Z9d Z:ej        	                    dnddg          d             Z;d Z<ej        	                    dne=e>g          d             Z?ej        	                    d]g d          d             Z@ej        	                    dddg          ej        	                    ddadg          d                         ZAej        	                    ddg          ej        	                    ddadg          d                         ZBej        	                    ddgdgg dg          ej        	                    ddadg          d                         ZCej        	                    deddag          ej        	                    dddag          ej        	                    d"e3eDe%j4        eeEg          d                                     ZFd ZGej        	                    deddag          ej        	                    dddag          d                         ZHd ZIej        	                    ddae%jJ        fefeKz  z   efeKdz   z  fda ed          fefeKz  z   e ed          fefeKz  z   fdefeKz  z   d ed          fz   efeKdEz   z   ed           ed          fz   ff          d             ZLej        	                    dddg          ej        	                    d eegdz  dagdz  z   d           eegdz  dagdz  z   d           edagdz             edagdz             edgdz             edgdz             eeMjN        gdz             eeMjN        gdz             ee%jJ        gdz             ee%jJ        gdz            g
          d                         ZOej        	                    dg d          d             ZPd ZQej        	                    dddg          ej        	                    d eddEdE           eRddEdE           e%j&        dȦ          ddg          dʄ                         ZSej        	                    dd eeeg          fd eddgeT          fg          dЄ             ZUdф ZVd҄ ZWdӄ ZXdԄ ZYdՄ ZZdք Z[ej        	                    d edئ           edd٬*          f eddڬ*           edd٬*          fg          d܄             Z\ej        	                    dg dޢ          d߄             Z]d Z^d Z_ej        	                    dddgd eddڬ*          gd eddEdEd e`ja        d                    gg          d             ZbdaS )TestToDatetimezignore:Could not infer formatc                    d}d}t          j        t          |          5  t          |           d d d            n# 1 swxY w Y   t          j        t          |          5  t          |g           d d d            n# 1 swxY w Y   t          |d          }|t          u sJ t          |gd          }t          j        |t          t          g                     t          |d          }t          |t                    r||k    sJ t          |gd          }t          j        |t          |gt                               d S )N08335394550z:Parsing "08335394550" to datetime overflows, at position 0ri   r   rz   rx   r+   )rl   rm   r   r   r   r2   r3   r   
isinstancer^   r0   )r4   rM   r   ress       r$   test_to_datetime_overflowz(TestToDatetime.test_to_datetime_overflow@  s   
 J].c::: 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ].c::: 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 #h///czzzz3%111
c5#<<000#h///#s##2s



3%111
c5#f#=#=#=>>>>>s!   <A A "A??BBc                    t          ddddt          t          d                               }t          ddddt          t          d                               }t          d|g          }t          ||g                              t          t          d	                              }t          j        ||           d S )
N  r      )hoursr      z2020-01-01 17:00 -0100r   r   )r   r   r   r   
tz_convertr2   r3   )r4   d1d2r&  r7   s        r$   *test_to_datetime_mixed_datetime_and_stringz9TestToDatetime.test_to_datetime_mixed_datetime_and_stringW  s    dAq"Xyq7I7I7I6I-J-JKKKdAq"Xyq7I7I7I6I-J-JKKK3R899Bx((33HYs=S=S=S4T4TUU
c8,,,,,r&   c                    ddg}t          d |D                       }t          |d          }t          |d d d         d          d d d         }t          |          }t          |d d d                   d d d         }t          j        ||           t          j        ||           t          j        ||           t          j        ||           d S )Nz
2016-01-01r   c                 ,    g | ]}t          |          S rT   rU   rV   s     r$   rY   zLTestToDatetime.test_to_datetime_mixed_string_and_numeric.<locals>.<listcomp>b  s    !=!=!=1)A,,!=!=!=r&   mixedr   )r   r   r2   r3   )r4   valsr7   r6   result2result3result4s          r$   )test_to_datetime_mixed_string_and_numericz8TestToDatetime.test_to_datetime_mixed_string_and_numeric_  s    a  !=!=!=!=!=>>T'222d44R4j999$$B$?%%TTrT
++DDbD1
fh///
gx000
gx000
gx00000r&   rE   r   r   ISO8601non-ISO8601idsc                     t          ddd          }t          d|g|          }t          ddgd          }t          j        ||           d S )	Nr)  r   rg   
2020-01-01r   z
2020-01-02r   r+   )r   r   r   r2   r3   )r4   rE   r.  r&  r7   s        r$   &test_to_datetime_mixed_date_and_stringz5TestToDatetime.test_to_datetime_mixed_date_and_stringm  s\    
 $1<,V<<< ,!=XNNN
c8,,,,,r&   r   %Y-%d-%m %H:%M:%S%zr   znon-ISO8601 formatzISO8601 formatzutc, args, expectedTz2000-01-01 01:00:00-08:00z2000-01-01 02:00:00-08:00z2000-01-01 09:00:00+00:00z2000-01-01 10:00:00+00:00datetime64[ns, UTC]r+   zall tz-aware, with utc)idFz2000-01-01 01:00:00+00:002000-01-01 02:00:00+00:00zall tz-aware, without utcz%all tz-aware, mixed offsets, with utc2000-01-01 01:00:00z+tz-aware string, naive pydatetime, with utcconstructorc                 D    t          |                                           S Nr   to_pydatetimerX   s    r$   <lambda>zTestToDatetime.<lambda>      ill88:: r&   c                      ||d                   }|d         }t          ||g||          }t          j        ||           d S )Nr   r   r   r   )	r4   r   r  argsr7   rF  ts1ts2r6   s	            r$   6test_to_datetime_mixed_datetime_and_string_with_formatzETestToDatetime.test_to_datetime_mixed_datetime_and_string_with_formatw  sR    p k$q'""1gc3Z===
fh/////r&   c                 D    t          |                                           S rH  rI  rK  s    r$   rL  zTestToDatetime.<lambda>  rM  r&   c                 V   ddg} ||d                   }|d         }d}t          t          d          t          dd          g          }t          j        t          |	          5  t          ||g|d
          }d d d            n# 1 swxY w Y   t          j        ||           d S )NrE  rD  r   r   r   z2000-01-01 02:00:00+0000r   r   ri   Fr   )r   r   r2   r   r   r   r3   )	r4   r   rF  rO  rP  rQ  r   r7   r6   s	            r$   Ntest_to_datetime_mixed_datetime_and_string_with_format_mixed_offsets_utc_falsez]TestToDatetime.test_to_datetime_mixed_datetime_and_string_with_format_mixed_offsets_utc_false  s     &'BCk$q'""1gK/004???
 
 'SAAA 	D 	D #sCUCCCF	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D
fh/////s   (B		BBzfmt, expectedz2000-01-01 09:00:00+0100r   r   z2000-01-02 02:00:00+0200z	UTC+02:00zISO8601, non-UTCz2000-02-01 02:00:00+0200znon-ISO8601, non-UTCc                     d}t          j        t          |          5  t          g d|d          }d d d            n# 1 swxY w Y   t          j        ||           d S )Nr   ri   z2000-01-01 09:00:00+01:00z2000-01-02 02:00:00+02:00NFr   r2   r   r   r   r3   )r4   r   r7   r   r6   s        r$   +test_to_datetime_mixed_offsets_with_none_tzz:TestToDatetime.test_to_datetime_mixed_offsets_with_none_tz  s    : L'SAAA 	 	 PPP  F	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	fh/////s   ?AA)2000-01-01 08:00:00+00:00z2000-01-02 00:00:00+00:00r   zISO8601, UTC)rZ  z2000-02-01 00:00:00+00:00r   znon-ISO8601, UTCc                 X    t          g d|d          }t          j        ||           d S )NrW  Tr   r   )r4   r   r7   r6   s       r$   (test_to_datetime_mixed_offsets_with_nonez7TestToDatetime.test_to_datetime_mixed_offsets_with_none  sB    . LLL
 
 

 	fh/////r&   rO  z2000-01-01 02:00:00-07:00z*all tz-aware, mixed timezones, without utcc                 D    t          |                                           S rH  rI  rK  s    r$   rL  zTestToDatetime.<lambda>(  rM  r&   c                      ||d                   } ||d                   }t          j        t          d          5  t          ||g|d           d d d            d S # 1 swxY w Y   d S )Nr   r   z1cannot be converted to datetime64 unless utc=Trueri   Fr   rl   rm   rn   r   )r4   r   rO  rF  rP  rQ  s         r$   =test_to_datetime_mixed_datetime_and_string_with_format_raiseszLTestToDatetime.test_to_datetime_mixed_datetime_and_string_with_format_raises  s    0 k$q'""k$q'""]Q
 
 
 	; 	; c
3E::::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	;s   A  A$'A$c                    t          j        d          }t          |g          }t          dd          }t	          |          |k    sJ t	          |j        d                   |k    sJ t	          |g          }t          |g          }t          j        ||           t	          |          }t          |          }t          j	        ||           d S )Nz2019-02-04 10:18:46.297000+0000z2019-02-04 10:18:46.297000r   r   r   )
r.   str_r   r   r   ilocr   r2   r3   r_   )r4   r   ra   r   r&  r7   s         r$   test_to_datetime_np_strz&TestToDatetime.test_to_datetime_np_str7  s     9::eWoo4???5!!S((((38A;''3....5'""#<<
c8,,,#(##
sH-----r&   zs, _format, dtz2015-1-1z%G-%V-%u  r      r   z2015-1-4  r   z2015-1-7r   c                 4    t          ||          |k    sJ d S r   r   )r4   s_formatr   s       r$   %test_to_datetime_iso_week_year_formatz4TestToDatetime.test_to_datetime_iso_week_year_formatK  s(     1W---333333r&   zmsg, s, _format)dISO week directive '%V' is incompatible with the year directive '%Y'. Use the ISO year '%G' instead.1999 50z%Y %V)xISO year directive '%G' must be used with the ISO week directive '%V' and a weekday directive '%A', '%a', '%w', or '%u'.z1999 51z%G %V)rn  z1999 Mondayz%G %A)rn  z1999 Monz%G %a)rn  1999 6z%G %w)rn  ro  z%G %u)rn  2051z%G)`Day of the year directive '%j' is not compatible with ISO year directive '%G'. Use '%Y' instead.z1999 51 6 256z%G %V %u %j)rl  1999 51 Sundayz%Y %V %A)rl  1999 51 Sunz%Y %V %a)rl  	1999 51 1z%Y %V %w)rl  rt  z%Y %V %u)xISO week directive '%V' must be used with the ISO year directive '%G' and a weekday directive '%A', '%a', '%w', or '%u'.20z%V)ru  rr  %V %A)ru  rs  z%V %a)ru  rt  z%V %w)ru  rt  z%V %u)rq  rm  z%G %j)ru  z	20 Mondayrw  rz   raiser   rx   c                     t          j                    dk    r_t          j                    dk    rJt          j        t          |          5  t          |||           d d d            d S # 1 swxY w Y   d S d S d S )N)r   UTF-8)r   r{  ri   r   )r  r  rl   rm   rn   r   )r4   r   ri  rj  rz   s        r$   test_error_iso_week_yearz'TestToDatetime.test_error_iso_week_yearW  s    @ !3338H8J8J O
 9
 9
 z555 > >Agf====> > > > > > > > > > > > > > > > > >	 43 9
 9
   
A**A.1A.r   Nz
US/Centralc                 d    t          ddd|          }|j        }t          |          }||u sJ d S )N
1965-04-03   2Wperiodsfreqr   )r   _datar   )r4   r   dtir5   r6   s        r$   test_to_datetime_dtarrz%TestToDatetime.test_to_datetime_dtarr  s?     rDDDiS!!}}}}}}r&   	arg_classr  c                 .   t          j        d          }t          ddd|          } ||          }|                    t	          j        |                    d|                              }t          ||          }t          ||                              t	          j        |                    d|s|nd	                              }|s|t          ur||u sJ |t          u rt          j
        ||           d S t          j        ||           d S )
Npyarrowr  r  r  r  ns)unitr   r  r   )rl   importorskipr   astyper   
ArrowDtype	timestampr   r   r2   r_   r3   )	r4   r   r  r  par  	dti_arrowr6   r7   s	            r$   test_to_datetime_arrowz%TestToDatetime.test_to_datetime_arrow  s    
  ++rDDDinnJJr}R\\t\-K-KLLMM	YC000s,,,33M",,Ds5MRR,NNOO
 
  	'y.. Y&&&&"6844444!&(33333r&   c                 p    t          t          ddd                    }|t          ddd          k    sJ d S )N  r      r   r   r4   actuals     r$   test_to_datetime_pydatetimez*TestToDatetime.test_to_datetime_pydatetime  s>    XdAr2233$2........r&   c                 R    t          d          }|t          ddd          k    sJ d S )N20080115r  r   r  r  r  s     r$   test_to_datetime_YYYYMMDDz(TestToDatetime.test_to_datetime_YYYYMMDD  s2    Z(($2........r&   c                 8    d}t          |d          |k    sJ d S )NzMonth 1, 1999rx   r$  r   )r4   ra   s     r$   "test_to_datetime_unparsable_ignorez1TestToDatetime.test_to_datetime_unparsable_ignore	  s+    3x000C777777r&   c                    t          j        d          5  t          d                              d          }t	          d          }t	          dg          d         }t          |j        |j        z
            dk     sJ t          |j        |j        z
            dk     sJ |j        J |j        J 	 d d d            d S # 1 swxY w Y   d S )N
US/Easternnowr  r       _B)r2   set_timezoner   as_unitr   abs_valuer   )r4   r  pdnowpdnow2s       r$   test_to_datetime_nowz#TestToDatetime.test_to_datetime_now  s    _\** 	) 	)E""**400C&&E %))!,F u|cj011D8888v}sz122T9999<'''=((((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)s   BCCCzPacific/AucklandzUS/Samoac                 ,   t          j        |          5  t          j        d                              d                              t          j                  }t          d          }t          dg          d         }t          d                              d          }t          j	                                        d          }t          |                                j        |z
            dk     sJ t          |                                j        |z
            dk     sJ t          |j        |j        z
            dk     sJ t          |j        |j        z
            dk     sJ |j        J |j        J 	 d d d            d S # 1 swxY w Y   d S )Ntodaydatetime64[ns]r   r  r  )r2   r  r.   
datetime64r  int64r   r   r  r  r  	normalizer  r   )r4   r   nptodaypdtodaypdtoday2tstodaytstoday2s          r$   test_to_datetime_todayz%TestToDatetime.test_to_datetime_today  s    _R   	+ 	+mG,,334DEELLRXVVG!'**G"G9--a0H((0066G ((0066H w((**1G;<<tCCCCx))++2W<==DDDDw~677$>>>>w~7884????>)))?****!	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+s   E&F		FFrM   r  r  c                 &    t          |g           d S rH  r   )r4   rM   s     r$   (test_to_datetime_today_now_unicode_bytesz7TestToDatetime.test_to_datetime_today_now_unicode_bytes:  s    SEr&   zformat, expected_ds))r   
2020-01-03)rA  z
2020-03-01)Nr  zstring, attribute)r  utcnow)r  r  c                     t          d|g|d          }t          | t          t          |                      gd          }||z
                                                                  dk     sJ d S )Nz2020-01-03 00:00:00ZTr   rB  r+   r   )r   r   getattrr   maxtotal_seconds)r4   rE   expected_dsstring	attributer6   r7   s          r$    test_to_datetime_now_with_formatz/TestToDatetime.test_to_datetime_now_with_format>  s    " 4f=fRVWWW 7')Y7799:BW
 
 
 6!&&((66881<<<<<<r&   r   
2000-01-01
2000-01-02c                 N    t          ||          t          |          k    sJ d S )Nr   rL   )r4   r%   r   s      r$   test_to_datetime_dt64sz%TestToDatetime.test_to_datetime_dt64sU  s.     2U+++y}}<<<<<<r&   arg, format)
2001-01-01r   )z
01-01-2001z%d-%m-%Yc                     t          |t          j        d          g|          }t          ddg          }t	          j        ||           d S )Nr?  r   r  )r   r.   r  r   r2   r3   )r4   rM   rE   r6   r7   s        r$   test_to_datetime_dt64s_and_strz-TestToDatetime.test_to_datetime_dt64s_and_str[  sP     c2=#>#>?OOO ,!=>>
fh/////r&   z
1000-01-01z
5000-01-02)ry  rx   r   c                     t          |||          }t          |t                    sJ |j        dk    sJ |j        |k    sJ t          |          }|j        dk    sJ |j        |k    sJ d S )Nrz   r%   ri  )r   r%  r   r  asm8)r4   r%   r   rz   tss        r$   'test_to_datetime_dt64s_out_of_ns_boundsz6TestToDatetime.test_to_datetime_dt64s_out_of_ns_boundsh  sy     F%888"i(((((w#~~~~w"}}}}r]]w#~~~~w"}}}}}}r&   c                    t          j        t          j        t           j                  j        d          }d}t          j        t          |          5  t          |           d d d            n# 1 swxY w Y   t          j        t          |          5  t          |d|           d d d            n# 1 swxY w Y   t          |d|          t          u sJ d S )NDz7Out of bounds second timestamp: 25252734927768524-07-27ri   ry  r  r   )r.   r  iinfor  r  rl   rm   r   r   r   r   )r4   r%   dt64r   s       r$   $test_to_datetime_dt64d_out_of_boundsz3TestToDatetime.test_to_datetime_dt64d_out_of_boundsw  sE   }RXbh//3S99G].c::: 	 	dOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	].c::: 	; 	;WE::::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 4>>>#EEEEEEs$   A00A47A4B55B9<B9r  ri  r  c                    t          j        d|          t          j        d|          gdz  }t          ||          }|rt          d |D             d          }nt          d |D             d	          }t	          j        ||           |t          j        d
          gz   }t          |d           t          |d|          }|sNt          t          |d                   j        t          |d                   j        gdz  t          gz             }n#t          t          j	        |d                    }t	          j        ||           t          |d|          }|st          |          }t	          j        ||           d S )Nr  r  r   r   c                 6    g | ]}t          |          j        S rT   r   r  rV   s     r$   rY   zBTestToDatetime.test_to_datetime_array_of_dt64s.<locals>.<listcomp>  !    %E%E%EAill&7%E%E%Er&   zM8[s]r+   c                 6    g | ]}t          |          j        S rT   r  rV   s     r$   rY   zBTestToDatetime.test_to_datetime_array_of_dt64s.<locals>.<listcomp>  r  r&   r   
9999-01-01ry  r$  r   r  r   r   rx   )r.   r  r   r   r2   r3   r   r  r   r/   r   )r4   r%   r  dtsr6   r7   dts_with_oobs          r$   test_to_datetime_array_of_dt64sz.TestToDatetime.test_to_datetime_array_of_dt64s  s   
 M,--M,--
  S... 	W$%E%E%E%E%EWUUUHH$%E%E%E%E%EXVVVH
fh/// bmL99:: 	L1111\(%HHH 	L$<?++0)LO2L2L2QRUWW% HH
 %RXl'%J%J%JKKH
fh///
 \(%HHH 	+\**H
fh/////r&   c                     t          t          j        d          d          }t          j        d          }||k    sJ d S )Nr  rx   r$  )r   r.   r  r   s      r$    test_out_of_bounds_errors_ignorez/TestToDatetime.test_out_of_bounds_errors_ignore  sD    R]<88JJJ=..!!!!!!r&   c                 $   d}t          j        t          |          5  t          t	          dt
          j        g          d          }d d d            n# 1 swxY w Y   t	          dt
          j        g          }t          j        ||           d S )Nerrors='ignore' is deprecatedri   z
2362-01-01rx   r$  )r2   r   r   r   r   r.   rk   r_   )r4   r   r&  r   s       r$   !test_out_of_bounds_errors_ignore2z0TestToDatetime.test_out_of_bounds_errors_ignore2  s    -'SAAA 	O 	OflBF%;<<XNNNC	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	OlBF+,,
sC(((((s   +AAAc                     t          dd          t          dd          g}t          ||          }t          ddgd          }t          j        ||           d S )Nz2013-01-01 13:00:00-0800r   r   z2013-01-02 14:00:00-0800r   2013-01-01 13:00:002013-01-02 14:00:00r   r   r   r2   r3   )r4   r%   r5   r6   r7   s        r$   test_to_datetime_tzz"TestToDatetime.test_to_datetime_tz  s{     0\BBB0\BBB
 S... "$9:|
 
 
 	fh/////r&   c                 \   t          dd          t          dd          g}d}t          j        t          |          5  t	          ||           d d d            n# 1 swxY w Y   d	}t          j        t          |          5  t	          ||d
          }d d d            n# 1 swxY w Y   t          t          d          t          d          gd          }t          j	        ||           t	          ||d          }t          ddgd          }t          j	        ||           d S )Nr  r   r   r  r  zLTz-aware datetime.datetime cannot be converted to datetime64 unless utc=Trueri   r   r  rx   )r%   rz   z2013-01-01 13:00:00-08:00z2013-01-02 14:00:00-05:00r0   r+   r   r   zdatetime64[ns, US/Pacific])r   rl   rm   rn   r   r2   r   r   r   r3   r   )r4   r%   r5   r   depr_msgr6   r7   s          r$   test_to_datetime_tz_mixedz(TestToDatetime.test_to_datetime_tz_mixed  s    +===+===

6 	 ]:S111 	* 	*5))))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 3'XFFF 	D 	D E(CCCF	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D566566 
 
 
 	fh///Sh??? (%08T
 
 
 	fh/////s$    AA"%A"B%%B),B)c                    d}d}|gdz  |gdz  z   }t          d |D                       }d}t          j        t          |          5  t	          ||          }d d d            n# 1 swxY w Y   t          j        ||           d S )NMarch 1, 2018 12:00:00+0400March 1, 2018 12:00:00+0500rR   c                 ,    g | ]}t          |          S rT   r	   rV   s     r$   rY   zETestToDatetime.test_to_datetime_different_offsets.<locals>.<listcomp>  s    000q%((000r&   r   ri   r   )r   r2   r   r   r   r3   )r4   r%   ts_string_1ts_string_2r5   r7   r   r6   s           r$   "test_to_datetime_different_offsetsz1TestToDatetime.test_to_datetime_different_offsets  s     43ma;-!"3300C00011K'SAAA 	3 	3 E222F	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3
fh/////s   A&&A*-A*c                 r   t          j        d          }t          j        |                    t          ddddd                    |                    t          ddddd                    gt                    }t          |d	|
          }t          ddgdd           }t          j
        ||           d S )Nr  r   r   r   r   )yearmonthdayhourminute   r+   Tr  r%   rZ  2000-06-01 07:00:00+00:00rB  r,   r  )r  r   r.   r/   localizer   r0   r   r   r2   r3   )r4   r%   
us_easternr5   r6   r7   s         r$   test_to_datetime_tz_pytzz'TestToDatetime.test_to_datetime_tz_pytz  s    ]<00
h##$aQQqIII  ##$aQQqIII 	 

 

 

 Sd%888 (*EF'
 
 

 	fh/////r&   z!init_constructor, end_constructorc                     ddg}t          dd          t          dd          g}t           ||          dd|	          } ||          }t          j        ||           d S )
N20100102 12131420100102 1213152010-01-02 12:13:14r  r   2010-01-02 12:13:15%Y%m%d %H%M%STrE   r  r%   )r   r   r2   rF   )r4   r%   init_constructorend_constructorr   expected_datar6   r7   s           r$   test_to_datetime_utc_truez(TestToDatetime.test_to_datetime_utc_true  s     "#45+666+666

 T""?E
 
 
 #?=11
)))))r&   zscalar, expectedr  r  r  r  c                 <    t          |dd|          }||k    sJ d S )Nr  Tr  r   )r4   r%   scalarr7   r6   s        r$    test_to_datetime_utc_true_scalarz/TestToDatetime.test_to_datetime_utc_true_scalar#  s1     VOUSSS!!!!!!r&   c                     d}t          t          |g          d|          }t          t          |d          g          }t          j        ||           d S )Ng {ѴCTr  r  r   )r   r   r   r2   r_   )r4   r%   r  r6   r7   s        r$   2test_to_datetime_utc_true_with_series_single_valuezATestToDatetime.test_to_datetime_utc_true_with_series_single_value/  sY    VRD\\t5AAA9RE222344
vx00000r&   c                     d}d}t          |gdz            }t          |d|          }t          t          |d          gdz            }t          j        ||           d S )Nz2013-01-01 00:00:00-01:002013-01-01 01:00:00r   Tr  r  r   r   r   r   r2   r_   )r4   r%   r  expected_tsr   r6   r7   s          r$   4test_to_datetime_utc_true_with_series_tzaware_stringzCTestToDatetime.test_to_datetime_utc_true_with_series_tzaware_string6  sn    (+rdQhTt59999[U;;;<q@AA
vx00000r&   zdate, dtype)r  r  )r  rB  c                     t          t          dd          gd          }t          t          |g|          d|          }t          j        ||           d S )Nr  r   r   M8[ns, UTC]r+   Tr  r   r   r   r2   r_   )r4   r%   r   r,   r7   r6   s         r$   1test_to_datetime_utc_true_with_series_datetime_nsz@TestToDatetime.test_to_datetime_utc_true_with_series_datetime_ns>  sl     ,7778
 
 
 VTF%888d%PPP
vx00000r&   c                    t          j        d          }|                    dd           }|                    dd           }t          j        t          ddddd|	          t          dd
ddd|	          gt                    }t          |dd|          }t          ddgdd           }t          j
        ||           t          dg|                    dd                     }	t          |	          sJ t          |	d|          }t          j
        ||	           t          |	dd|          }t          dgd          }t          j
        ||           d S )Nzpsycopg2.tzi)r  r  ir   r   r   r   r   r  r+   r   T)rz   r  r%   rZ  r  rB  r  z2000-01-01 08:00:00r   r  z2000-01-01 13:00:00)rl   r  FixedOffsetTimezoner.   r/   r   r0   r   r   r2   r3   r   )
r4   r#   r%   psycopg2_tztz1tz2r5   r6   r7   is
             r$   test_to_datetime_tz_psycopg2z+TestToDatetime.test_to_datetime_tz_psycopg2L  s   )-88 --T-EE--T-EEhq!Q#666q!Q#666 
 
 
 St5III (*EF'
 
 

 	fh/// "#..d.FF
 
 
 &a((((( Qxu===
fa(((QxTGGG "7!8@UVVV
fh/////r&   c                     d}t          j        t          |          5  t          |           d d d            n# 1 swxY w Y   t          |d|          t          u sJ t          |d|          |u sJ d S )Nz2dtype bool cannot be converted to datetime64\[ns\]ri   r   r  rx   )rl   rm   	TypeErrorr   r   )r4   r%   rM   r   s       r$   test_datetime_boolz!TestToDatetime.test_datetime_boolr  s     D]9C000 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	3xu===DDDD3xu===DDDDDDs   :>>c                 D   t          |           d}t          j        t          |          5  t	          dt          j                    g|           d d d            n# 1 swxY w Y   t          j        t          dt           d          5  t	          ddg|           d d d            n# 1 swxY w Y   t          j
        t	          d	dt          d
gd|          t          t	          d	|          t          t          t	          d	|          g                     d S )Nz is not convertible to datetimeri   Fr   zA^time data "True" doesn\'t match format "%Y%m%d", at position 1. r	  20130101Tr   g        r   r  )typerl   rm   r!  r   r   r  rn   r  r2   r3   r   r   r4   r%   r   s      r$   test_datetime_bool_arrays_mixedz.TestToDatetime.test_datetime_bool_arrays_mixed{  s   e===]9C000 	@ 	@ 0 01????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@]5"15 5 5
 
 
 	9 	9 T*%8888	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	E3,XUKKKQe,,,c3AU8S8S8ST 	
 	
 	
 	
 	
s#   %AA#&A#B..B25B2c                     d}t          j        t          |          5  t          |           d d d            d S # 1 swxY w Y   d S )Nzis not convertible to datetimeri   )rl   rm   r!  r   )r4   rM   r   s      r$   test_datetime_invalid_datatypez-TestToDatetime.test_datetime_invalid_datatype  s     /]9C000 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   ;??)r   ry  rx   c                     t          j        t          d          5  t          dgd|           d d d            d S # 1 swxY w Y   d S )Nz*':' is a bad directive in format 'H%:M%:S%ri   z00:00:00zH%:M%:S%r   r_  )r4   rz   s     r$   test_invalid_format_raisesz)TestToDatetime.test_invalid_format_raises  s     ]J
 
 
 	H 	H ZGGGG	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H   =AAr   az00:01:99z%H:%M:%Sc                 V   t          |d|          }||k    sJ t          |d|          }|t          u sJ d                    dt           dddt           dd	g          }t	          j        t          |
          5  t          |d|           d d d            d S # 1 swxY w Y   d S )Nrx   rz   rE   r   r  @^time data "a" doesn\'t match format "%H:%M:%S", at position 0. r	  <^Given date string "a" not likely a datetime, at position 0$S^unconverted data remains when parsing with format "%H:%M:%S": "9", at position 0. 2^second must be in 0..59: 00:01:99, at position 0$ri   ry  )r   r   r  r  rl   rm   rn   r4   r   rE   r&  r   s        r$   test_datetime_invalid_scalarz+TestToDatetime.test_datetime_invalid_scalar  s"    %@@@e||||%@@@czzzzhh&"& & &O5"15 5 5E	
 	
 ]:S111 	> 	>gf====	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>s   >BB"%B"z3000/12/11 00:00:00c                    t          |d|          }||k    sJ t          |d|          }|t          u sJ |Jd}t          j        t          |          5  t          |d|           d d d            d S # 1 swxY w Y   d S d}t          j        t
          |          5  t          |d|           d d d            d S # 1 swxY w Y   d S )Nrx   r/  r   z:^time data ".*" doesn\'t match format ".*", at position 0.ri   ry  z!^Out of bounds .*, at position 0$)r   r   rl   rm   rn   r   r4  s        r$    test_datetime_outofbounds_scalarz/TestToDatetime.test_datetime_outofbounds_scalar  s    %@@@e||||%@@@czzzzOCz555 B BE'&AAAAB B B B B B B B B B B B B B B B B B 6C2#>>> B BE'&AAAAB B B B B B B B B B B B B B B B B Bs$   A77A;>A;!CCCrH   )r-  bz99:00:00c           	      H   |t          |          dk    rt          }nd }t          j        |dd          5  t	          |d|          }d d d            n# 1 swxY w Y   t          j        |t          ||dnd	                     t          j        |dd          5  t	          |d
|          }d d d            n# 1 swxY w Y   t          j        |t          t          gt          |          z                       d	                    ddt           ddt           ddg          }t          j        t          |          5  t          j        |dd          5  t	          |d|           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nr   Could not infer formatFrj   raise_on_extra_warningsrx   r/  r0   r^   r+   r   r  r1  r0  r	  r2  r3  ri   ry  )lenUserWarningr2   r   r   r3   r   r   r   r  r  rl   rm   rn   )r4   rH   rE   warnr&  r   s         r$   test_datetime_invalid_indexz*TestToDatetime.test_datetime_invalid_index  s0    >c&kkAooDDD'0%
 
 
 	F 	F fXfEEEC	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	vXXUKKK	
 	
 	
 '0%
 
 
 	F 	F fXfEEEC	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	c=#V1D#E#EFFFhhO&"& & &5"15 5 5E	
 	
 ]:S111 	C 	C+4e   C C F76BBBBC C C C C C C C C C C C C C C	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	CsY   AAA B??CCF E?3F?F	FF	FFFz%Y%m%d %H:%M:%Sc                     d}|gdz  } ||          }t          |||d          }t          |||d          }t          j        ||           d S N20130101 00:00:00順 T)r  rE   r%   Fr   )	r4   r  rE   rF  r   
test_datesr   r6   r7   s	            r$   test_to_datetime_cachez%TestToDatetime.test_to_datetime_cache  sh     #Ve^
{:&&Ts6FFFtV5III
fh/////r&   c                     t          t          t          d          gdz                      }t          t          d          gdz            }t          j        ||           d S )N2010-06-02 09:30:003   )r   r   r   r2   r3   r   s      r$   test_to_datetime_from_dequez*TestToDatetime.test_to_datetime_from_deque  s_    UI.C$D$D#E#JKKLL	*? @ @ABFGG
fh/////r&   c                     d}|gdz  }t          |          }t          |||d          }t          |||d          }t          j        ||           d S rB  r   )r4   r  rE   r   rE  r   r6   r7   s           r$   test_to_datetime_cache_seriesz,TestToDatetime.test_to_datetime_cache_series  sf     #Ve^
j!!Ts6FFFtV5III
vx00000r&   c                 Z    d}t          |d          }t          d          }||k    sJ d S )NrC  Tr   rL   )r4   r   r6   r7   s       r$   test_to_datetime_cache_scalarz,TestToDatetime.test_to_datetime_cache_scalar  s>    "T...011!!!!!!r&   zdatetimelikes,expected_valuesrg   z
2012-07-26rH  z2012 July 26c                     t          |d          }t          |d          }t          |d          }t          j        ||           d S )Nr0   r+   r   r$  r  r   )r4   datetimelikesexpected_valuesra   result_seriesexpected_seriess         r$   *test_convert_object_to_datetime_with_cachez9TestToDatetime.test_convert_object_to_datetime_with_cache  sg    0 
 
 
 $C999 "
 
 
 	}o>>>>>r&   r%   input   r0   r   r  c                     t          t          gt          |          z  d          }t          ||          }t	          j        ||           d S )Nr   r+   r   )r   r   r=  r   r2   r_   )r4   r%   rU  r7   r6   s        r$   *test_to_datetime_converts_null_like_to_natz9TestToDatetime.test_to_datetime_converts_null_like_to_nat7  sN    $ 3%#e**,H===U%000
vx00000r&   zdate, format))z2017-20z%Y-%W)	20 Sundayz%W %A)20 Sunz%W %a)z2017-21z%Y-%U)rY  z%U %A)rZ  z%U %ac                     d}t          j        t          |          5  t          ||           d d d            d S # 1 swxY w Y   d S )Nz,Cannot use '%W' or '%U' without day and yearri   r   r_  )r4   r   rE   r   s       r$   'test_week_without_day_and_calendar_yearz6TestToDatetime.test_week_without_day_and_calendar_yearM  s     =]:S111 	- 	-V,,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-   =AAc                 v   g d}d}t          j        t          |          5  t          |d          }d d d            n# 1 swxY w Y   t	          t          dddd	d
t          d d                    t          dddd	d
t          d d                    t          g          }t          j        ||           d S )N)r  r  20100240r   ri   r   r$    r   r   r   r   i@8  r   iPF  )	r2   r   r   r   r   r   r   r   r3   r4   
ts_stringsr   r6   r7   s        r$   test_to_datetime_coercez&TestToDatetime.test_to_datetime_coerce_  s   
 
 


 L'SAAA 	> 	> H===F	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>q!R8D%3H3HIIIq!R8D%3H3HIII
 
 	fh/////s   A  AAzstring_arg, format)zMarch 1, 2018z	%B %d, %Y)z
2018-03-01r   outofboundsi'  r  zJanuary 1, 9999c                     ||g}t          |d|          }t          t          ddd          t          g          }t	          j        ||           d S )Nr   r/  r`  r   r   )r   r   r   r   r2   r3   )r4   
string_argrE   rd  rb  r6   r7   s          r$   test_to_datetime_coerce_oobz*TestToDatetime.test_to_datetime_coerce_oobr  sY      !+.
ZHHH (4A"6"6!<==
fh/////r&   zerrors, expectedr   rx   200622-12-31111111-24-11c                     ddg}t          j        t          dd          5  t          ||          }d d d            n# 1 swxY w Y   t          j        ||           d S )Nrh  ri  r:  Fr;  r$  )r2   r   r>  r   r3   )r4   rz   r7   rb  r6   s        r$   #test_to_datetime_malformed_no_raisez2TestToDatetime.test_to_datetime_malformed_no_raise  s     %n5
'7QV
 
 
 	< 	< !F;;;F	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	fh/////s   ?AAc                    ddg}d}t          j        t          |          5  t          j        t
          d          5  t          |d           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nrh  ri  zParsed string "200622-12-31" gives an invalid tzoffset, which must be between -timedelta\(hours=24\) and timedelta\(hours=24\), at position 0ri   r:  ry  r$  rl   rm   rn   r2   r   r>  r   )r4   rb  r   s      r$    test_to_datetime_malformed_raisez/TestToDatetime.test_to_datetime_malformed_raise  s-   $n5
 	
 ]
 
 
 
	 
	 +#;     "                 	
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	s4   A4AA4A 	 A4#A 	$A44A8;A8c                 6   d}t          |          }t          |          }||k    sJ t          t          |          gdz            }t          |gdz            }t          j        ||           t          |gdz            }t          j        ||           d S )N2015-11-18 15:30:00+05:30rg   )r   r   r   r2   r3   )r4   ts_strr6   r7   s       r$   &test_iso_8601_strings_with_same_offsetz5TestToDatetime.test_iso_8601_strings_with_same_offset  s    ,V$$V$$!!!! )F"3"3!4q!899fX\**
fh///x!|,,
fh/////r&   c                    ddt           g}d}t          j        t          |          5  t	          |          }d d d            n# 1 swxY w Y   t          j        t          ddddd	t          d d
                    t          ddddd	t          d d                    t           gt                    }t          |          }t          j        ||           d S )Nrp  2015-11-18 16:30:00+06:30r   ri   rg     r,  r  r   iXM  r      ih[  r+   )r   r2   r   r   r   r.   r/   r   r   r0   r   r3   ra  s        r$   ,test_iso_8601_strings_with_different_offsetsz;TestToDatetime.test_iso_8601_strings_with_different_offsets  s   13NPST
K'SAAA 	- 	- ,,F	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-8r2r2htU6K6KLLLr2r2htU6K6KLLL
 
 
 
 ??
fh/////s   AAAc           	          ddt           g}t          |d          }t          t          dddd          t          dddd          t           gd	
          }t	          j        ||           d S )Nrp  rt  Tr  rg  ru  r,  r   r   r   )r   r   r   r   r2   r3   )r4   rb  r6   r7   s       r$   0test_iso_8601_strings_with_different_offsets_utcz?TestToDatetime.test_iso_8601_strings_with_different_offsets_utc  sz    13NPST
ZT222 tRR(()D"b"*E*EsKPU
 
 
 	fh/////r&   c                    dt          d          ddd ddgt                    t          fdt          t	                              D                       sJ t          d          }t          d          }d}t          j        t          |	          5  t                    }d d d            n# 1 swxY w Y   t          d
t          d          t          d          	                                t          d          	                                d gt                    }t          j        |d d         |           ||j        d         z
                                  dk    sJ ||j        d         z
                                  dk    sJ t          j        t           d	          5  t          |           d d d            d S # 1 swxY w Y   d S )Nrk   z
1990-01-01z2015-03-14T16:15:14.123-08:00z2019-03-04T21:56:32.620-07:00r  r  c              3   8   K   | ]}|         |         u V  d S rH  rT   )rW   r  ra   r5  s     r$   	<genexpr>zPTestToDatetime.test_mixed_offsets_with_native_datetime_raises.<locals>.<genexpr>  s0      ??3q6T!W$??????r&   r   ri   r   r+   r4  g?zTz-aware datetime.datetime)r   r   allranger=  r2   r   r   r   rJ  r0   r_   rc  r  rl   rm   rn   )r4   r  r  r   r3  r7   ra   r5  s         @@r$   .test_mixed_offsets_with_native_datetime_raisesz=TestToDatetime.test_mixed_offsets_with_native_datetime_raises  s^    l##++
 Tll?????eCII.>.>????????'""K'SAAA 	% 	%$$E	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%,''9::HHJJ9::HHJJ 	
 	
 	
 	uSbSz8444 ejn$3355<<<<
2&55773>>>>]:-IJJJ 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s$   B77B;>B;0GGGc                     t          dgdz            }t          t          ddddt          t	          d                    	          gdz            }t          j        ||           d S )
Nr  rg   r`  r   r   r      r   r   )r   r   r   r   r   r2   r3   r   s      r$   #test_non_iso_strings_with_tz_offsetz2TestToDatetime.test_non_iso_strings_with_tz_offset  st    ;<q@AA dAq"Xi6L6L6L-M-MNNNORSS
 
 	fh/////r&   zts, expectedz
2018-01-01r   r   z2018-01-01 08:00c                 8    t          |d          }||k    sJ d S )NTr  r   )r4   r  r7   r6   s       r$   test_timestamp_utc_truez&TestToDatetime.test_timestamp_utc_true  s-     RT***!!!!!!r&   dt_str)00010101130001013000010199990101c                     d}t          j        t          |          5  t          |d           d d d            d S # 1 swxY w Y   d S )N"Out of bounds nanosecond timestampri   r[   r   rl   rm   r   r   )r4   r  r   s      r$   *test_to_datetime_with_format_out_of_boundsz9TestToDatetime.test_to_datetime_with_format_out_of_bounds  s     3].c::: 	1 	1x0000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1r]  c                     t          j        t          d          gt                    }t	          |d          }|j        t          j        u sJ d S )Nz2012-06-13T01:39:00Zr+   Tr  )r.   r/   r
   r0   r   r   r   r  )r4   r5   r6   s      r$   test_to_datetime_utcz#TestToDatetime.test_to_datetime_utc  sO    h4556fEEESd+++yHL((((((r&   c                     ddl m}  |dd          }t          ddd|          t          ddd|          t          ddd	|          g}t          |          }|j        |k    sJ d S )
Nr   )r  i\z-07:00r   r   r   rg   r   )-pandas.tests.indexes.datetimes.test_timezonesr  r   r   r   )r4   r  	fixed_offr   r6   s        r$   test_to_datetime_fixed_offsetz,TestToDatetime.test_to_datetime_fixed_offset  s    MMMMMMKh//	 T1a	222T1a	222T1a	222

 U##yI%%%%%%r&   r   z2020-10-26 00:00:00+06:00z2020-10-26 00:00:00+01:00r)  r,  zAustralia/Melbourner   c                     d}t          j        t          |          5  t          |d           d d d            d S # 1 swxY w Y   d S )Nr   ri   Fr  r2   r   r   r   )r4   r   r   s      r$   8test_to_datetime_mixed_offsets_with_utc_false_deprecatedzGTestToDatetime.test_to_datetime_mixed_offsets_with_utc_false_deprecated+  s     L'SAAA 	) 	)%((((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)r]  )cr  r  r  rl   r  filterwarningsr'  r0  r9  r  r@  r!   r   r   rR  rU  r   r   rY  r\  r`  rd  r   rk  r|  r  r  skip_if_windowsr   r  r  r  r  r  r  r  r  r.   r  r  r  r  
skip_ubsanr  r  r  r  r  r  r  r  listr/   r
  r  r  r  r  r  r"  r'  boolr   r)  r+  r5  r7  r@  tupler   rF  rJ  rL  rN  rk   r   rT  r   r   rX  r\  rc  r   rg  r0   rk  rn  rr  rw  ry  r  r  r  r  r  r  r  r   r  rT   r&   r$   r!  r!  ?  sW       [ ?@@? ? A@?,- - -1 1 1 [:z*M0J   - - - [	 56!#34   
 [FL,.IJ02MN/   ,   FL,.IJ02MN  /   FL,.IJ02MN/   ;   FL&(CD02MN/   A  7$	
' 'P [	::; 
0 
0	 Q' ' b
0 [	 56!#34   
 [	::; 0 0	  0, [FL%!	"<MMM!	"<MMM  &
 
 
 FL%!	"<MMM!	"<MMM  *
 
 
	
 6
0 
07 6
0 [FL%UUU/   "   FL%UUU/   &  	
 *0 0+ *0 [	 56!#34   
 [FL,.IJ?  	
  [	::; ; ;	   $;. . .( [XXdBAq%A%ABXXdAq!Q%?%?@XXdAq!Q%?%?@	
 4 4 4 [                                      [s	
v vn [X'D'D'DEE> > FEov vp> [TD,#788  98 [[65/::[UT5M22[TD,#7884 4 98 32 ;: 4*/ / // / /8 8 8
 ) ) )  [T$6
#CDD+ + ED +2 [UUG$455  65 [	
 	
 	
  [	
 = =  = [}r}\**MBM,,G,GH = = = [&&	
 0 0 0 [}r}\**MBM,,G,GH  [X'D'D'DEE	 	 FE 	 [	F 	F 	F [Vc3Z00*0 *0 10*0X" " ") ) )0 0 00 0 0>
0 
0 
00 0 0, [+M"=!X}%V		
 * * * [		*?E J J JK		*?E J J JK	
 " " "
1 1 11 1 1 [5:	
 1 1 1$0 $0 $0L [UT5M22E E 32E
 
 
& [UT;$788  98 [X'D'D'DEEH H FEH [WsJ&788[Xj'9::> > ;: 98>* [W'<&=>>[Xj'9::B B ;: ?>B" [	se
|/E/E/EG  [X'=>>$C $C ?> $CL [UT4L11[X(94'@AA[]T5"(E5,QRR0 0 SR BA 2100 0 0 [UT4L11[X(94'@AA1 1 BA 211" " " [' rv#*:!::*Q./
 yy../3&;K2KKii--.#:J1JJ
 &++,!99\#:#:;< *Q./9\**IIl,C,CDE		
 (? ?) (? [WtUm44[FC52:+8<<<FC52:+8<<<FD6B;FD6B;FB4"9FB4"9FBE7R<  FBE7R<  FBF8b=!!FBF8b=!!	
 1 1  54 1 [	
 	
 	

 
- -
 
-0 0 0& [	')CD  [HT1a  Dq!BM,''	
	 	0 0	 		 0 [uuc3Z(()uunn=VLLLM	
 0 0 0  (0 0 00 0 0$0 0 0% % %N0 0 0 [Y|$$ii&G&G&GH	,<888	,777	
	 	" "	 	"
 [X'W'W'WXX1 1 YX1) ) )& & & [(*EF())L\*R*R*RS+q!R>S0T0TUUU	

 
) )
 
) ) )r&   r!  c            	       <   e Zd Zej                            dddg          ej                            dd ed          g          d                         Zej                            dddg          d             Zd Z	d	 Z
d
 Zd Zd Zej                            dg d          d             Zej                            dg d          ej                            dddg          d                         Zej                            dg dg degg dg ddgg          d             Zej                            d ed          dd gdd  ed          gg          d!             Zd" Zd# Zd$ Zej                            deeg          d%             Zej                            d&eej        g          d'             Zd( Zd) Zej                            d*d+d,g          d-             Zej                            d*d+d,g          d.             Z d/ Z!dS )0TestToDatetimeUnitr  YMitem   c                 d   t          ||          }t          |gd          }t          |g||          }t          j        ||           t          t          j        |gt                    ||          }t          j        ||           t          t          j        |g          ||          }t          j        ||           t          t          j        |t
          j        g          ||          }|	                                d         sJ t          j        |d d         |           d S )Nr  r   r+   r  r%   r   )
r   r   r   r2   r3   r.   r/   r0   rk   r   )r4   r%   r  r  r#   r  r7   r6   s           r$   'test_to_datetime_month_or_year_unit_intz:TestToDatetimeUnit.test_to_datetime_month_or_year_unit_int>  s    t$''' "X666dV$e<<<
fh///RXtfF;;;$eTTT
fh///RXtf--DFFF
fh/// RXtRVn55DNNN{{}}Q
fRaRj(33333r&   c                 v   d}d| d}t          j        t          |          5  t          dg|d           d d d            n# 1 swxY w Y   t          j        t          |          5  t          t	          j        dg          |d           d d d            n# 1 swxY w Y   t          j        t          |          5  t          j        t          |          5  t          dg|d           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   t          j        t          |          5  t          dg|d	           d d d            n# 1 swxY w Y   t          dg|d
          }t          t          gd          }t          j        ||           t          j        t          |          5  t          dg|d
          }d d d            n# 1 swxY w Y   t          j        ||           t          dg|          }t          dg|          }t          j        ||           d S )Nz*strings will be parsed as datetime stringsz(Conversion of non-round float with unit=z is ambiguousri         ?ry  r  rz   z1.5rx   r   r   r+         ?r  r   )rl   rm   rn   r   r.   r/   r2   r   r   r   r   r3   )r4   r%   r  warn_msgr   r&  r7   s          r$   3test_to_datetime_month_or_year_unit_non_round_floatzFTestToDatetimeUnit.test_to_datetime_month_or_year_unit_non_round_floatS  s   
 @LLLL]:S111 	: 	:D9999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:]:S111 	D 	D#d7CCCC	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D]:S111 	@ 	@+MJJJ @ @UG$w????@ @ @ @ @ @ @ @ @ @ @ @ @ @ @	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ ]:S111 	; 	;D::::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 3%d8<<<#h///
c8,,,'XFFF 	C 	CugDBBBC	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C
c8,,, 3%d+++s...
c8,,,,,s}   AAA*&BB #B DC>2D>D	DD	DDD;EE"E G  G$'G$c                     d}t          j        t          |          5  t          dgdd|           d d d            d S # 1 swxY w Y   d S )Nz#cannot specify both format and unitri   r   r  r[   )r  rE   r%   r_  r&  s      r$   	test_unitzTestToDatetimeUnit.test_unitt  s     4]:S111 	E 	E#heDDDD	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	Es   A  AAc                     t          j        t                    5  t          dgdd          }d d d            n# 1 swxY w Y   t          dgdd          }t          j        ||           d S )N
1704660000ri  unixr  origini erX  )r4   r%   r&  r7   s       r$   test_unit_strz TestToDatetimeUnit.test_unit_str{  s     '66 	G 	G|n3vFFFC	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G
|#fEEE
c8,,,,,s   :>>c           
      <   dddt           t          t          j        ddg}t	          |dd|          }t          dt          d	          t          d	          t          t          t          t          t          gt          
          }t          j	        ||           t	          |dd|          }t          g dd
          }t          j	        ||           d}t          j        t          |          5  t	          |dd|           d d d            d S # 1 swxY w Y   d S )Nl   qMe;r   r  r   r  r  rx   r  rz   r%   
1970-01-02r+   r   )r   r  r  r   r   r   r   r   r   z8cannot convert input 11111111111111111 with the unit 'D'ri   ry  )r   r   r.   rk   r   r   r   r0   r2   r3   r   rl   rm   r   r4   r%   rH   r6   r7   r   s         r$   test_unit_array_mixed_nansz-TestToDatetimeUnit.test_unit_array_mixed_nans  s   #QT3rJV#heLLL!,'',''	 
 
 
 	fh///V#heLLL RRR
 
 
 	fh///H].c::: 	G 	GSFFFF	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	Gs   0DDDc                    dt           t          t          j        dg}t	          |dd|          }t          dt          t          t          t          gt                    }t          j        ||           t	          |dd|          }t          g dd	          }t          j        ||           d
}t          j        t          |          5  t	          |dd|           d d d            d S # 1 swxY w Y   d S )Nl     #0U.KK% r   rx   ri  rz   r  r%   r+   r   )r   r   r   r   r   r   z@cannot convert input 1420043460000000000000000 with the unit 's'ri   ry  )r   r   r.   rk   r   r   r0   r2   r3   r   rl   rm   r   r  s         r$   $test_unit_array_mixed_nans_large_intz7TestToDatetimeUnit.test_unit_array_mixed_nans_large_int  sH   +T3FVH3eLLL3S#sCHPVWWW
fh///VH3eLLL !D!D!DHUUU
fh///P].c::: 	G 	GwSFFFF	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	Gs   C,,C03C0c                     d}t          j        t          |          5  t          ddd|           d d d            d S # 1 swxY w Y   d S )Nz+non convertible value foo with the unit 's'ri   r  ry  ri  r  r_  r&  s      r$   8test_to_datetime_invalid_str_not_out_of_bounds_valuerrorzKTestToDatetimeUnit.test_to_datetime_invalid_str_not_out_of_bounds_valuerror  s     <]:S111 	F 	FgCuEEEE	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F   ?AAerrorrx  c                     t          d          }t          dd||          }||k    sJ t          |t                     sJ d S )Nz1970-05-09 14:25:11iǊ ri  r  )r   r   r%  )r4   r%   r  r7   r6   s        r$   test_unit_consistencyz(TestToDatetimeUnit.test_unit_consistency  sU     233XCUKKK!!!!&),,,,,,,r&   rz   )rx   ry  r   r,   float64r  c                     t          ddgd          }t          j        ddg                              |          }t	          |||          }t          j        ||           d S )N2015-06-19 05:33:202015-05-27 22:33:20r   r+   @CA5Cr  )r   r.   r/   r  r   r2   r3   )r4   r%   rz   r,   r7   r5   r6   s          r$   test_unit_with_numericz)TestToDatetimeUnit.test_unit_with_numeric  st    
 !"$9:(
 
 
 h[12299%@@Su===
fh/////r&   zexp, arr, warning)r   r  r  )r  r  r  )r  r  r   r   )r  r  r  r   Nc                     t          |d          }t          j        |d          5  t          |d|          }d d d            n# 1 swxY w Y   t          j        ||           d S )Nr   r+   r:  ri   r   r  )r   r2   r   r   r3   )r4   r%   r   r5   warningr7   r6   s          r$   test_unit_with_numeric_coercez0TestToDatetimeUnit.test_unit_with_numeric_coerce  s    $ !H555'7OPPP 	D 	D XUCCCF	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D
fh/////s   AAAr5   r$  r  r  c                     t          d |D             d          }t          |d|          }t          j        ||           t          |d|          }t          j        ||           t	          |          }t          j        ||           d S )Nc                 ,    g | ]}t          |          S rT   rU   rV   s     r$   rY   z6TestToDatetimeUnit.test_unit_mixed.<locals>.<listcomp>  s    4441)A,,444r&   r   r+   r   r  ry  )r   r   r2   r3   r   )r4   r%   r5   r7   r6   s        r$   test_unit_mixedz"TestToDatetimeUnit.test_unit_mixed  s     44444HEEES???
fh/// S>>>
fh///s##
fh/////r&   c                     d}t          |d|          }t          d          }||k    sJ t          |d          }||k    sJ d S )Ng aAri  r  z2015-06-19 19:55:31.877000093r  rL   )r4   r%   r   r6   r7   alts         r$   test_unit_roundingz%TestToDatetimeUnit.test_unit_rounding  s_     #UE:::<==!!!!C(((f}}}}}}r&   c                     t          dgdz  d          }t          |dd|          }t          j        ||           d S )Ng   Brg   r  r  rx   ri  r  )r   r   r2   r3   r4   r%   r7   r6   s       r$   test_unit_ignore_keeps_namez.TestToDatetimeUnit.test_unit_ignore_keeps_name  sI    $!&111XhSNNN
fh/////r&   c                 |    t          dgddd          }t          dgd          }t          j        ||           d S )	Nr   ri  Trx   )r  r  rz   1970-01-01 00:00:01r  r+   r  r   s      r$   'test_to_datetime_errors_ignore_utc_truez:TestToDatetimeUnit.test_to_datetime_errors_ignore_utc_true
  sI    aSsXFFF "7!8NNN
fh/////r&   c                    dt          fdt          d          D                                           |          }t          |d          }t          d t          d          D             d          }t	          j        ||           d S )	NQc                     g | ]}|z   S rT   rT   rW   tepochs     r$   rY   z<TestToDatetimeUnit.test_to_datetime_unit.<locals>.<listcomp>      333Aeai333r&   rV  ri  r  c                 N    g | ]"}t          d           t          |          z   #S z2013-06-09 02:42:28)secondsr   r   rW   r  s     r$   rY   z<TestToDatetimeUnit.test_to_datetime_unit.<locals>.<listcomp>  A        /009Q3G3G3GG  r&   r   r+   )r   r  r  r   r2   r_   )r4   r,   ra   r6   r7   r  s        @r$   test_to_datetime_unitz(TestToDatetimeUnit.test_to_datetime_unit  s    3333r33344;;EBBSs+++ r   
 
 
 	vx00000r&   nullc                    dt          fdt          d          D             |gz             }t          |d          }t          d t          d          D             t          gz   d          }t	          j        ||           d S )	Nr  c                     g | ]}|z   S rT   rT   r  s     r$   rY   zGTestToDatetimeUnit.test_to_datetime_unit_with_nulls.<locals>.<listcomp>!  r  r&   rV  ri  r  c                 N    g | ]"}t          d           t          |          z   #S r  r  r  s     r$   rY   zGTestToDatetimeUnit.test_to_datetime_unit_with_nulls.<locals>.<listcomp>$  s1    XXXY,--	!0D0D0DDXXXr&   r   r+   )r   r  r   r   r2   r_   )r4   r  ra   r6   r7   r  s        @r$    test_to_datetime_unit_with_nullsz3TestToDatetimeUnit.test_to_datetime_unit_with_nulls  s    3333r333tf<==Ss+++XXeTViiXXXe
 
 

 	vx00000r&   c                    dt          fdt          j        ddd          D             t          gz                                 t
                    }t          |d          }t          d t          j        ddd          D             t          gz   d	
          }|                    d          }t          j
        ||           d S )Nr  c                     g | ]}|z   S rT   rT   r  s     r$   rY   zOTestToDatetimeUnit.test_to_datetime_unit_fractional_seconds.<locals>.<listcomp>-  s    ???Aeai???r&   r   rg   g      ?ri  r  c                 N    g | ]"}t          d           t          |          z   #S r  r  r  s     r$   rY   zOTestToDatetimeUnit.test_to_datetime_unit_fractional_seconds.<locals>.<listcomp>0  r  r&   r   r+   ms)r   r.   aranger   r  rd   r   r   roundr2   r_   )r4   ra   r6   r7   r  s       @r$   (test_to_datetime_unit_fractional_secondsz;TestToDatetimeUnit.test_to_datetime_unit_fractional_seconds*  s    ????1a)>)>???4&HIIPPQVWWSs+++ 1a..   e	
 
 
 
 d##
vx00000r&   c                     t          dddt          t          j        gd          }t	          t          d          t          d          gdgdz  z   d	
          }t          j        ||           d S )Nr   rg   r   r  r  r  
1970-01-03r   r   r+   )r   r   r.   rk   r   r   r2   r3   r   s      r$   test_to_datetime_unit_na_valuesz2TestToDatetimeUnit.test_to_datetime_unit_na_values;  sv    aE37cBBB |$$i&=&=>%1L
 
 
 	fh/////r&   bad_valr  ikc                     | d}t          j        t          |          5  t          dd|gd           d d d            d S # 1 swxY w Y   d S )Nz with the unit 'D'ri   r   rg   r  r  r_  )r4   r  r   s      r$   test_to_datetime_unit_invalidz0TestToDatetimeUnit.test_to_datetime_unit_invalidC  s    ,,,]:S111 	3 	3Awc2222	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3s   AA
Ac                     t          t          d          t          d          gdgdz  z   d          }t          dd|gdd	
          }t          j        ||           d S )Nr  r  r   r   r   r+   rg   r  r   r  )r   r   r   r2   r3   )r4   r  r7   r6   s       r$   test_to_timestamp_unit_coercez0TestToDatetimeUnit.test_to_timestamp_unit_coerceI  ss     !|$$i&=&=>%1L
 
 
 aG_3xHHH
fh/////r&   c                 *   d}d}d|z  }t          d|dz
  | dz   gt                    }||z                      t          j                  }dD ]}t          |d|	          }t          j        |                    t          j                                      t          j                  |                    t          j                  d
           t          d|dz   gt                    }t          d| dz
  gt                    }	t          j
        t          |          5  t          |dd	           d d d            n# 1 swxY w Y   t          j
        t          |          5  t          |	dd	           d d d            d S # 1 swxY w Y   d S )Nz"cannot convert input with unit 'D'g  S$Bl            r   g{Gzt?r+   rx  r  r  g|=)rtolri   ry  )r   rd   r  r.   r  r   r2   assert_almost_equalr  rl   rm   r   )
r4   r   oneday_in_nstsmax_in_daysshould_succeedr7   
error_moderesult1should_fail1should_fail2s
             r$   (test_float_to_datetime_raise_near_boundsz;TestToDatetimeUnit.test_float_to_datetime_raise_near_boundsS  sG   2),%~'=>e
 
 
 #\199"(CC7 	 	J!.s:NNNG "rx((//
;;
++     q-%"78FFFq=.5"89GGG].c::: 	@ 	@3w????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@].c::: 	@ 	@3w????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@s$   #EE	E(FFF)"r  r  r  rl   r  r  rd   r  r  r  r  r  r  r  r  r  r>  r  r   r  r  r  r  intr  r   r.   rk   r  r  r  r  r  r  rT   r&   r$   r  r  =  s       [Vc3Z00[Vc55::%6774 4 87 104& [Vc3Z00- - 10-@E E E- - -G G G:G G GF F F [W&C&C&CDD- - ED- [X'D'D'DEE[Wy'&:;;0 0 <; FE0 [ FEE111 MLL888	
 0 0 0 [Yz""K=+yy'<'<=	
 0 0 0"	 	 	0 0 00 0 0 [WsEl331 1 431 [VdBF^44	1 	1 54	11 1 1"0 0 0 [Y	(:;;3 3 <;3
 [Y	(:;;0 0 <;0@ @ @ @ @r&   r  c                   <   e Zd Zej        d             Zd Zd Zej        	                    dddddd	d
ddddddddg          d             Z
d Zd Zd Zd Zej        	                    ddgddgg dddgg dg          d             Zd Zd Zd Zd Zd Zd S )!TestToDatetimeDataFramec                 X    t          ddgddgddgddgd	d
gddgddgddgddgd	          S )Nrg    rg   r   r   rR   r     :   ;   r   ru  r   	r  r  r  r  r  secondr  usr  )r   r4   s    r$   dfzTestToDatetimeDataFrame.dfp  s]    tQ1vAr(r(!f!f!f
 

 
 	
r&   c                 T   t          |d         |d         |d         d|          }t          t          d          t          d          g          }t          j        ||           t          |g d                                         |          }t          j        ||           d S )Nr  r  r  r  r  r  r   20150204 00:00:00z20160305 00:0:00)r   r   r   r2   r_   to_dictr4   r  r%   r6   r7   s        r$   test_dataframez&TestToDatetimeDataFrame.test_dataframe  s    Z"W+biHHPU
 
 
 *++Y7I-J-JK
 
 	vx000 R 8 8 89AACC5QQQ
vx00000r&   c                     |g d                                          }d|d<   t          ||          }t          t          d          t          d          g          }t	          j        ||           d S )Nr  rg   r  r   r  z20160205 00:0:00)r  r   r   r   r2   r_   )r4   r  r%   df2r6   	expected2s         r$   &test_dataframe_dict_with_constructablez>TestToDatetimeDataFrame.test_dataframe_dict_with_constructable  s~    )))*2244GS...*++Y7I-J-JK
 
	 	vy11111r&   r  yearsmonthsdaysr+  r   r  )r  r  r  r  r  r  r  r  r  r  r  r  c                    t          |t          |                                                                       |          |          }t	          t          d          t          d          gd          }t          j        ||           d S )Ncolumnsr   z20150204 06:58:10z20160305 07:59:11r   r+   )r   r  keysrenamer   r   r2   r_   )r4   r  r%   r  r6   r7   s         r$   *test_dataframe_field_aliases_column_subsetzBTestToDatetimeDataFrame.test_dataframe_field_aliases_column_subset  s    . RTYY[[ 1 1299$9GGuUUU*++Y7J-K-KL
 
 
 	vx00000r&   c           
          ddddddddd	d
	}t          |                    |          |          }t          t          d          t          d          g          }t	          j        ||           d S )Nr  r  r  r  r  r  r  r  r  r  r"  r   20150204 06:58:10.00100200320160305 07:59:11.001002003)r   r%  r   r   r2   r_   )r4   r  r%   dr6   r7   s         r$   test_dataframe_field_aliasesz4TestToDatetimeDataFrame.test_dataframe_field_aliases  s    

 

 RYYqY11???788788
 
 	vx00000r&   c                     t          |                    t                    |          }t          t	          d          t	          d          g          }t          j        ||           d S )Nr   r(  r)  )r   r  r^   r   r   r2   r_   r  s        r$   test_dataframe_str_dtypez0TestToDatetimeDataFrame.test_dataframe_str_dtype  se    RYYs^^5999788788
 
 	vx00000r&   c                 X   t          ddgddgddgd          }d}t          j        t          |	          5  t	          ||
           d d d            n# 1 swxY w Y   t	          |d|          }t          t          d          t          g          }t          j	        ||           d S )Nrg  r  rg   rV  r   rR   r  z^^cannot assemble the datetimes: time data ".+" doesn\'t match format "%Y%m%d", at position 1\.ri   r   r   r  r  )
r   rl   rm   rn   r   r   r   r   r2   r_   )r4   r%   r  r   r6   r7   s         r$   test_dataframe_coercez-TestToDatetimeDataFrame.test_dataframe_coerce  s    $BAOOPP6 	 ]:S111 	* 	*5))))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* S???9%8993?@@
vx00000s   AAAc                     d}t          j        t          |          5  |                                }d|d<   t	          ||           d d d            d S # 1 swxY w Y   d S )Nz?extra keys have been passed to the datetime assemblage: \[foo\]ri   r   r  r   )rl   rm   rn   copyr   )r4   r  r%   r   r  s        r$   !test_dataframe_extra_keys_raisesmz9TestToDatetimeDataFrame.test_dataframe_extra_keys_raisesm  s    P]:S111 	* 	*''))CCJ5))))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*s   +AAAcols)r  r  r  )r  r  r  c                     d}t          j        t          |          5  t          ||         |           d d d            d S # 1 swxY w Y   d S )Nz`to assemble mappings requires at least that \[year, month, day\] be specified: \[.+\] is missingri   r   r_  )r4   r  r%   r3  r   s        r$   "test_dataframe_missing_keys_raisesz:TestToDatetimeDataFrame.test_dataframe_missing_keys_raises  s    5 	 ]:S111 	/ 	/4....	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/s   AA
Ac                    d}t          ddgddgddgd          }g d	|_        t          j        t          |
          5  t          ||           d d d            n# 1 swxY w Y   t          ddgddgddgddgd          }g d|_        t          j        t          |
          5  t          ||           d d d            d S # 1 swxY w Y   d S )Nz#cannot assemble with duplicate keysrg  r  rg   rV  r   rR   r  )r  r  r  ri   r   )r  r  r  r  )r  r  r  r  )r   r#  rl   rm   rn   r   )r4   r%   r   r  s       r$   'test_dataframe_duplicate_columns_raisesz?TestToDatetimeDataFrame.test_dataframe_duplicate_columns_raises 	  s   3$BAOOPP---]:S111 	* 	*5))))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* D\QGQFQPQFSS
 
 655]:S111 	* 	*5))))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*s$    AA"%A")CCCc                     t          ddgddgddgd          }t          |                    d          |	          }t          t	          d
          t	          d          g          }t          j        ||           d S )Nrg  r  rg   r   r   rR   r  int16r   r  20160305 00:00:00)r   r   r  r   r   r2   r_   r4   r%   r  r6   r7   s        r$   test_dataframe_int16z,TestToDatetimeDataFrame.test_dataframe_int16	  s    t1vq!fMMNN RYYw//u===*++Y7J-K-KL
 
 	vx00000r&   c                 R   t          ddgddgddgd          }|d                             d	          |d<   |d
                             d	          |d
<   t          ||          }t          t	          d          t	          d          g          }t          j        ||           d S )Nrg  r  rg   r   r   rR   r  r  int8r  r   r  r:  )r   r  r   r   r   r2   r_   r;  s        r$   test_dataframe_mixedz,TestToDatetimeDataFrame.test_dataframe_mixed	  s    t1vq!fMMNNk((007uI$$V,,5	Ru---*++Y7J-K-KL
 
 	vx00000r&   c                     t          ddgddgddgd          }d}t          j        t          |          5  t	          ||           d d d            d S # 1 swxY w Y   d S )	Nr   r   r  r   r  zk^cannot assemble the datetimes: unconverted data remains when parsing with format ".*": "1", at position 0.ri   r   )r   rl   rm   rn   r   )r4   r%   r  r   s       r$   test_dataframe_floatz,TestToDatetimeDataFrame.test_dataframe_float%	  s    tQxAOOPP5 	 ]:S111 	) 	)%((((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)s   AAAc                     t          ddgddgddgd          }t          |d	          }t          t          j        d
dgd                    j                            d          }t          j        ||           d S )Nrg  r  rg   r   r   rR   r  Tr  z
2015-02-04z
2016-03-05r  r+   r   )	r   r   r   r.   r/   r   tz_localizer2   r_   )r4   r  r6   r7   s       r$   test_dataframe_utc_truez/TestToDatetimeDataFrame.test_dataframe_utc_true/	  s    t1vq!fMMNNRT***HlL19IJJJ
 

[[ 	 	vx00000r&   N)r  r  r  rl   fixturer  r  r  r  r  r&  r+  r-  r/  r2  r5  r7  r<  r?  rA  rD  rT   r&   r$   r	  r	  o  s       ^
 
 ^
1 1 12 2 2 [  !##   "" 	
 *1 1+ *11 1 1,	1 	1 	11 1 1* * * [HW'''e%%%	
	 	/ /	 	/* * *	1 	1 	1	1 	1 	1) ) )1 1 1 1 1r&   r	  c                       e Zd Zd Zej                            dddgddgg          d             Zej                            dg d          ej                            d	d
dg          d                         Zej                            dg d          d             Z	ej                            dg d          d             Z
ej                            dg d          d             Zej                            dg d          d             Zej                            dg d          d             Zej                            dg d          d             Zd Zej                            d          d             Zd Zd Zej        d             Zd  Zej        ej                            d!g d"          d#                         Zd$ Zd% Zd& Zd' Zd( Zej                            d) ed*           ed*          g          d+             Z d, Z!d- Z"d. Z#d/ Z$d0 Z%d1 Z&d2 Z'd3 Z(d4 Z)ej                            d5g d6          d7             Z*d8 Z+d9 Z,d: Z-ej                            d;e.e/j0        g          d<             Z1d=S )>TestToDatetimeMiscc                     t          j        dgt                    }d}t          j        t
          |          5  t          |           d d d            d S # 1 swxY w Y   d S )Nz2262-04-11 23:47:16.854775808r+   z6^Out of bounds nanosecond timestamp: .*, at position 0ri   )r.   r/   r0   rl   rm   r   r   )r4   r5   r   s      r$   %test_to_datetime_barely_out_of_boundsz8TestToDatetimeMisc.test_to_datetime_barely_out_of_bounds:	  s     h78GGGF].c::: 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AAAzarg, exp_str2012-01-01 00:00:0020121001z
2012-10-01c                 d    t          |g|          }t          |          }|d         |k    sJ d S )Nr   r   rL   )r4   r%   rM   exp_strr6   r   s         r$   test_to_datetime_iso8601z+TestToDatetimeMisc.test_to_datetime_iso8601D	  s@     cU%000  ayCr&   zinput, format))2012%Y-%m)z2012-01r   )
2012-01-01r   )2012-01-01 10r   )2012-01-01 10:00r   )2012-01-01 10:00:00r   )z2012-01-01 10:00:00.123r   r   r   r   TFc                     t          j        t          d| d| d          5  t          |||           d d d            d S # 1 swxY w Y   d S )Ntime data \"z\" doesn't match format \"\", at position 0ri   r   r_  )r4   rU  rE   r   s       r$   test_to_datetime_iso8601_failsz1TestToDatetimeMisc.test_to_datetime_iso8601_failsP	  s    " ]0 0 00 0 0
 
 
 	; 	; fE::::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	;s   AA
A)rQ  rP  )rR  r   )rS  r   )rT  r   rU  c                     d                     dt           ddt           dg          }t          j        t          |          5  t          ||           d d d            d S # 1 swxY w Y   d S )Nr  r
  r	  z:^time data ".*" doesn't match format ".*", at position 0. ri   r   r  )r4   rU  rE   r   s       r$   $test_to_datetime_iso8601_exact_failsz7TestToDatetimeMisc.test_to_datetime_iso8601_exact_failsj	  s     hh7$37 7 7&"& & &
 
 ]
 
 
 	. 	. f----		. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s   A$$A(+A()rZ  )z2012-01-01 00r   )z2012-01-01 00:00r   )rJ  r   c                 \    t          ddd          }t          ||d          }||k    sJ d S )Nr   r   Fr   r   r   r4   rU  rE   r7   r6   s        r$   "test_to_datetime_iso8601_non_exactz5TestToDatetimeMisc.test_to_datetime_iso8601_non_exact	  s@     T1a((U6???!!!!!!r&   ))2020-01z%Y/%m)r?  z%Y/%m/%d)2020-01-01 00z%Y/%m/%dT%H)2020-01-01T00z%Y/%m/%d %H)2020-01-01 00:00z%Y/%m/%dT%H:%M)2020-01-01T00:00z%Y/%m/%d %H:%M)2020-01-01 00:00:00z%Y/%m/%dT%H:%M:%S)2020-01-01T00:00:00z%Y/%m/%d %H:%M:%Sc                     t          j        t          d| d| d          5  t          ||           d d d            d S # 1 swxY w Y   d S )NrW  z\" doesn\'t match format \"rX  ri   r   r_  )r4   rU  rE   s      r$   "test_to_datetime_iso8601_separatorz5TestToDatetimeMisc.test_to_datetime_iso8601_separator	  s     ]0 0 00 0 0
 
 
 	. 	. f----	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s   AA	A))ra  rP  )r?  r   )rb  r   )rc  %Y-%m-%dT%H)rd  r   )re  %Y-%m-%dT%H:%M)rf  r   )rg  %Y-%m-%dT%H:%M:%S)z2020-01-01T00:00:00.000%Y-%m-%dT%H:%M:%S.%f)z2020-01-01T00:00:00.000000rm  )z2020-01-01T00:00:00.000000000rm  c                 Z    t          ddd          }t          ||          }||k    sJ d S Nr)  r   r   r^  r_  s        r$   test_to_datetime_iso8601_validz1TestToDatetimeMisc.test_to_datetime_iso8601_valid	  >    $ T1a((U6222!!!!!!r&   ))z2020-1rP  )z2020-1-1r   )z
2020-1-1 0r   )z
2020-1-1T0rj  )z2020-1-1 0:0r   )z2020-1-1T0:0rk  )z2020-1-1 0:0:0r   )z2020-1-1T0:0:0rl  )z2020-1-1T0:0:0.000rm  )z2020-1-1T0:0:0.000000rm  )z2020-1-1T0:0:0.000000000rm  c                 Z    t          ddd          }t          ||          }||k    sJ d S ro  r^  r_  s        r$   #test_to_datetime_iso8601_non_paddedz6TestToDatetimeMisc.test_to_datetime_iso8601_non_padded	  rq  r&   ))z#2020-01-01T00:00:00.000000000+00:00z%Y-%m-%dT%H:%M:%S.%f%z)z2020-01-01T00:00:00+00:00%Y-%m-%dT%H:%M:%S%z)z2020-01-01T00:00:00Zrt  c                 r    t          dddt          j                  }t          ||          }||k    sJ d S )Nr)  r   r   r   )r   r  r   r   r_  s        r$   ,test_to_datetime_iso8601_with_timezone_validz?TestToDatetimeMisc.test_to_datetime_iso8601_with_timezone_valid	  sE     T1a999U6222!!!!!!r&   c                 Z    t          d|          }t          ddd          }||k    sJ d S )N2001r   r   r   r  )r4   r%   rsxps       r$   test_to_datetime_defaultz+TestToDatetimeMisc.test_to_datetime_default	  s6    u---dAq!!Rxxxxxxr&   z1fails to enforce dayfirst=True, which would raise)r   c                     d}t          j        t          |          5  t          j        t
          d          5  t          dd|           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )NzInvalid date specifiedri   zProvide formatz
01-13-2012Tdayfirstr%   rm  r&  s      r$   "test_to_datetime_respects_dayfirstz5TestToDatetimeMisc.test_to_datetime_respects_dayfirst	  s*   
 ']:S111 	F 	F +K?OPPP F FL4uEEEEF F F F F F F F F F F F F F F	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	Fs4   A1AA1A	A1 A	!A11A58A5c                     t          t          dd                    }t          ||          }|d         |d         k    sJ d S )NrA   r   r  r   r   )r   r   r   )r4   r%   ra   r6   s       r$   %test_to_datetime_on_datetime64_seriesz8TestToDatetimeMisc.test_to_datetime_on_datetime64_series	  sM    Z
B77788S...ayCF""""""r&   c                    t          g d          }dt           d}t          j        t          |          5  t          |d|           d d d            n# 1 swxY w Y   t          |d|          }t          t          dd	d
          t          dd	d
          t          g          }t          j	        ||           t          |d|          }t          j	        ||           d S )N)z
10/18/2006z
10/18/2008 z@^time data " " doesn\'t match format "%m/%d/%Y", at position 2. r	  ri   ry  r  r   i  r   r,  r  rx   )
r   r  rl   rm   rn   r   r   r   r2   r_   )r4   r%   ra   r   result_coerceexpected_coerceresult_ignores          r$   %test_to_datetime_with_space_in_seriesz8TestToDatetimeMisc.test_to_datetime_with_space_in_series	  s4   666772.2 2 2 	 ]:S111 	: 	:G59999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:#CFFF (4R"8"8(4R:P:PRU!VWW
}o>>>#CFFF
}c22222s   AAAc                     t          g dg d          }t          |d|          } |j        t          d|          }t          j        ||           d S )N)May 04Jun 02zDec 11r   rg   r   index%b %yrD   r   r   r]   r2   r_   )r4   r%   r  r7   r6   s        r$   test_to_datetime_with_applyz.TestToDatetimeMisc.test_to_datetime_with_apply
  sf    
 222)))DDDr'???+gUCCC
vx00000r&   c                     t          dd          }t          ddd                              d          }||k    sJ d S )Nz2020-01-01 00:00:00UTCz%Y-%m-%d %H:%M:%S%Zr   r)  r   r   )r   r   rC  r   s      r$   test_to_datetime_timezone_namez1TestToDatetimeMisc.test_to_datetime_timezone_name
  sL    5>STTTT1a((44U;;!!!!!!r&   rz   rx  c                     t          g dg d          }t          |d|          } |j        fd          }t          j        ||           d S )N)r  r  r  r  r  r  ry   c                 *    t          | dd          S )Nr  r   ry   r   )rX   r%   s    r$   rL  zOTestToDatetimeMisc.test_to_datetime_with_apply_with_empty_str.<locals>.<lambda>'
  s    k!GHERRR r&   r  )r4   r%   rz   r  r7   r6   s    `    r$   *test_to_datetime_with_apply_with_empty_strz=TestToDatetimeMisc.test_to_datetime_with_apply_with_empty_str
  sr     ,,,III>>>r'&NNNRRRR
 
 	vx00000r&   c                 >    t          d|          }|t          u sJ d S Nr  r   )r   r   r4   r%   r6   s      r$   test_to_datetime_empty_sttz-TestToDatetimeMisc.test_to_datetime_empty_stt+
  s%    Ru---}}}}}}r&   c                 r    t          ddg|          }t          |                                          sJ d S r  )r   r   r~  r  s      r$   test_to_datetime_empty_str_listz2TestToDatetimeMisc.test_to_datetime_empty_str_list0
  s<    b"XU333F||!!!!!!!r&   c                 V    t          d          }t          d|          }||k    sJ d S )Nr   r   r^  r   s       r$   test_to_datetime_zeroz(TestToDatetimeMisc.test_to_datetime_zero4
  s6    1q...!!!!!!r&   c                 h    t          dg|          d         }t          d|          }||k    sJ d S )NrO  r   r   r   r  s       r$   test_to_datetime_stringsz+TestToDatetimeMisc.test_to_datetime_strings:
  sD    xu555a8V5111!!!!!!r&   c                 n    g d}fd|D             }d |D             }t          j        ||           d S )N)rO  20120101z20120101 12:01:01c                 2    g | ]}t          |           S )r   r   )rW   r  r%   s     r$   rY   zITestToDatetimeMisc.test_to_datetime_strings_variation.<locals>.<listcomp>B
  s&    IIIKe444IIIr&   c                 ,    g | ]}t          |          S rT   rU   )rW   date_strs     r$   rY   zITestToDatetimeMisc.test_to_datetime_strings_variation.<locals>.<listcomp>C
  s     <<<()H%%<<<r&   )r2   r  )r4   r%   r/   r7   r6   s    `   r$   "test_to_datetime_strings_variationz5TestToDatetimeMisc.test_to_datetime_strings_variation@
  sS    999IIII5III<<e<<<
vx00000r&   r6   rO  c                 8    t          ddd          }||k    sJ d S )Nr   r   rU   r   s      r$   'test_to_datetime_strings_vs_constructorz:TestToDatetimeMisc.test_to_datetime_strings_vs_constructorF
  s*    T1a((!!!!!!r&   c                 6   t          ddgd|          }t          t          j        ddgd                    }t	          j        ||           d}t          j        t          |          5  t          ddgd	|           d d d            d S # 1 swxY w Y   d S )
Nr   1rx   r  Or+   z<^Given date string "1" not likely a datetime, at position 1$ri   ry  )	r   r   r.   r/   r2   rF   rl   rm   rn   )r4   r%   r6   r7   r   s        r$   $test_to_datetime_unprocessable_inputz7TestToDatetimeMisc.test_to_datetime_unprocessable_inputK
  s     aXheDDD1c(#66677
)))L]:S111 	? 	?C>>>>	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?s   ,BBBc                 |    t          dggdz            }t          |d|          }t          j        ||           d S )Nr-  d   rx   r  r   )r4   r%   seriesr6   s       r$   !test_to_datetime_unhashable_inputz4TestToDatetimeMisc.test_to_datetime_unhashable_inputV
  sD    ##&&VHEBBB
vv.....r&   c                    t          j        d                              d          }|                    d          }t	          |g          }|d         |                    d          k    sJ t          |          }||k    sJ d S )Nl    `SD& zM8[us]r  r   )r.   r  viewr  r   r   )r4   r  as_objr  r   s        r$   'test_to_datetime_other_datetime64_unitsz:TestToDatetimeMisc.test_to_datetime_other_datetime64_units[
  s    *++00::s##vh''Qx6==------&!!r&   c                     t          dd          }t          |j                  }t          |j                  }t          |          }t          j        ||           d S )NrA   rV  r  )r   r   rH   r  asi8r2   r3   )r4   rngintsr6   s       r$   !test_to_datetime_list_of_integersz4TestToDatetimeMisc.test_to_datetime_list_of_integersf
  sV    R000CJ''CH~~t$$
c6*****r&   c                     d}t          j        t          |          5  t          ddd           d d d            d S # 1 swxY w Y   d S )Nz>Cannot cast 139999 days 00:00:00 to unit='ns' without overflowri   z1/1/1700BrD  )startr  r  )rl   rm   r   r   r4   r   s     r$   r'  z,TestToDatetimeMisc.test_to_datetime_overflowp
  s     O]/s;;; 	C 	CZc6BBBB	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C   >AAc                     t          j        dgt                    }t          j        t
          d          5  t          |d|           d d d            d S # 1 swxY w Y   d S )N87156549591102612381000001219H5r+   Unknown datetime string formatri   ry  r  )r.   r/   r0   rl   rm   rn   r   )r4   r%   invalids      r$   test_string_invalid_operationz0TestToDatetimeMisc.test_string_invalid_operationw
  s    (=>fMMM ]:-MNNN 	> 	>u====	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>s   AAAc                    t          j        ddt           j        dgt                    }t          j        dd          }t          |          D ]1\  }}t          |          rt          ||<   t          |          ||<   2t          j
        |          d         }t          j        ||           t          ||          }t          |t                    sJ t          j        ||j                   d S )	NrA   rB   z1/4/2000r+   r   r   r   r   )r.   r/   rk   r0   empty	enumerater   r   r
   r   array_to_datetimer2   r  r   r%  r   assert_numpy_array_equalrH   )r4   r%   stringsr7   r  r   r6   r6  s           r$   test_string_na_nat_conversionz0TestToDatetimeMisc.test_string_na_nat_conversion~
  s     (J
BFJGvVVV8AX...(( 	) 	)FAsCyy )"#Cjj(11!4
vx000gU333'=11111
#FGN;;;;;r&   c                    t          j        dt           j        gt                    }d}t	          j        t          |          5  t          |d|           d d d            n# 1 swxY w Y   t          |d|          }t          |t                    }t          j
        ||           t	          j        t          |          5  t          |d|           d d d            d S # 1 swxY w Y   d S )Nz
1/100/2000r+   r  ri   ry  r  rx   )r.   r/   rk   r0   rl   rm   rn   r   r   r2   r3   )r4   r%   	malformedr   r6   r7   s         r$   'test_string_na_nat_conversion_malformedz:TestToDatetimeMisc.test_string_na_nat_conversion_malformed
  s   HlBF36BBB	 0]:S111 	@ 	@	'????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ YxuEEE&111
fh///]:S111 	@ 	@	'????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@s$   A$$A(+A(C''C+.C+c           
         g d}t          dt          j        dt          j        dg|d          }t          t          d|          t          j        t          d|          t          j        t          d|          g|d          }t          ||          }t          ||          }t          t          j        dd	
          |          }t          d          D ]G}|j        |         }	t          |	          rt          |j        |<   .t          |	|          |j        |<   Ht          j
        ||d           |j        dk    sJ t          j
        ||d           |j        dk    sJ d S )N)r-  r8  cr*  erA   rC   z1/5/2000r  r  r  r   rR   r   r+   r  F)check_names)r   r.   rk   r   r  r  rc  r   r   r2   r_   r  )
r4   r%   idxr  dseriesr6   dresultr7   r  rX   s
             r$   'test_string_na_nat_conversion_with_namez:TestToDatetimeMisc.test_string_na_nat_conversion_with_name
  s   '''RVZ@RW
 
 
 Je444Je444Je444 

 

 

 V5111gU333"(1H555SAAAq 	? 	?AAAAww ?#&a  #.q#>#>#>a  
vxUCCCC{e####
weDDDD|u$$$$$$r&   r  )hmri  r  r  r  c                    t          j        d| d          }t          g d|          }|j                            |          }|dv rd}t          j        d| d          }t          |                    |                    }|j        |k    sJ t          j        t          |          |           t          j        t          ||          |           d S )NzM8[])z2000-01-01T00:00z2000-01-02T00:00r   r   )r  r  ri  )r.   r,   r   rH   r  r   r2   r3   )r4   r%   r  r,   baserH   	exp_dtyper7   s           r$   $test_dti_constructor_numpy_timeunitsz7TestToDatetimeMisc.test_dti_constructor_numpy_timeunits
  s     t''JJJRWXXX##E**:DH]4]]]++	 Y!7!788~****
mF33X>>>
k&>>>IIIIIr&   c           	         g d}t          t          ddd          t          ddd          t          ddd          g          }t          |d          }t          t          j        |          d          }t	          |d|	          }t	          t          j        |          d|	          }t          t          |          d          }t          t          |          d          }	t          j        ||           t          j        ||           t          j        ||           t          j        ||           t          j        ||           t          j        ||	           d S )
N)z
10/02/2014z
11/02/2014z
12/02/2014re  rg   r   ru  r   Tr~  r}  )	r   r   r.   r/   r   r   r   r2   r3   )
r4   r%   r5   r7   idx1idx2idx3idx4idx5idx6s
             r$   test_dayfirstz TestToDatetimeMisc.test_dayfirst
  sP   888 dAr""HT1b$9$98D!R;P;PQ
 
 S4000RXc]]T:::3U;;;28C==4uEEEU3ZZ$777VC[[4888
h---
h---
h---
h---
h---
h-----r&   c                 8   d}ddg}t          ddgdd           }t          |d	          }t          j        ||           t          j        t
          |
          5  t          |d	          }d d d            n# 1 swxY w Y   t          j        ||           d S )NzzParsing dates in .* format when dayfirst=.* was specified. Pass `dayfirst=.*` or specify a format to silence this warning.
31/12/2014z
10/03/2011z
2014-12-31z
2011-03-10r  r  Tr  ri   F)r   r   r2   r3   r   r>  )r4   warning_msgr5   r7   res1res2s         r$   "test_dayfirst_warnings_valid_inputz5TestToDatetimeMisc.test_dayfirst_warnings_valid_input
  s    N 	 \* <(0@t
 
 

 3...
h--- ';GGG 	4 	4sU333D	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4
h-----s   A::A>A>c                     ddg}t          j        t          dt           d          5  t	          |d           d d d            d S # 1 swxY w Y   d S )Nr  z
03/30/2011zI^time data "03/30/2011" doesn\'t match format "%d/%m/%Y", at position 1. r	  ri   Tr  )rl   rm   rn   r  r   )r4   r5   s     r$   $test_dayfirst_warnings_invalid_inputz7TestToDatetimeMisc.test_dayfirst_warnings_invalid_input  s     \*]B/>B B B
 
 
 	, 	, d++++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,s   AAAklassc                     t          dd                              d          }|                    d          } ||          } ||          }t          |d          }t	          j        ||           d S )Nz
2015-04-05r   r  r  r   Tr  )r   r%  rC  r   r2   rF   )r4   r  r  r7   objr6   s         r$   test_to_datetime_dta_tzz*TestToDatetimeMisc.test_to_datetime_dta_tz  sy     q11188????5))eCjj5??Sd+++
)))))r&   N)2r  r  r  rI  rl   r  r  rN  rY  r\  r`  ri  rp  rs  rv  r{  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r  r  r  r  r  r'  r  r  r  r  r  r  r  r  r   r   _from_sequencer  rT   r&   r$   rG  rG  9	  s          ["$9:&	
      
 [		
 		
 		
  [WtUm44
; 
; 54 
; [	
 	
 	
	 	. .	 	." [	
 	
 	
 " " " [		
 		
 		
 	. 	. 	. [	
 	
 	
  " "!  " [	
 	
 	
  " "!  " [	
 	
 	
 " " "  
 [QRR	F 	F SR	F# # #3 3 3 1 1 1" " " [X'D'D'DEE
1 
1 FE 
1  
" " "" " "" " "1 1 1 [X		&(9(9;;v;N;N'OPP" " QP"	? 	? 	?/ / /
	 	 	+ + +C C C> > >< < <&@ @ @  %  %  %D [))) J J	 J". . .&. . .,, , ," [W}m6R&STT	* 	* UT	* 	* 	*r&   rG  c                       e Zd Zej                            dg dej        ej        dgddgddgddgddgddgg          d	             Ze	j
        d
             ZdS )TestGuessDatetimeFormat	test_list)2011-12-30 00:00:00.000000r  r  r  r  r   random_stringr  r  c                 t    d}t          j        |t                    }t          j        |          |k    sJ d S )Nr   r+   )r.   r/   r0   tools _guess_datetime_format_for_array)r4   r  expected_format
test_arrays       r$   $test_guess_datetime_format_for_arrayz<TestGuessDatetimeFormat.test_guess_datetime_format_for_array   s?    " 1Xiv666
5jAA_TTTTTTr&   c                     t          j        t          j        t          j        t          j        t          j        gd                    }|J d S )Nr  r+   )r  r  r.   r/   rk   )r4   format_for_string_of_nanss     r$   -test_guess_datetime_format_for_array_all_nanszETestGuessDatetimeFormat.test_guess_datetime_format_for_array_all_nans5  sH    $)$JHbfbfbf-S999%
 %
! )00000r&   N)r  r  r  rl   r  r  r.   rk   r  r  r  r  rT   r&   r$   r  r    s        [  
 VRV9:-.01)?;0123	
  U U!  U
 1 1 1 1 1r&   r  c                   \   e Zd Zej                            dg d          d             Zd Zd Zd Z	d Z
ej                            dg d	          d
             Zej                            dg d          d             Zej                            dddg          d             Zd ZdS )TestToDatetimeInferFormattest_format)z%m-%d-%Yz%m/%d/%Y %H:%M:%S.%frm  c                     t          t          ddd                    }|                    fd          }t          ||          }t          ||          }t	          j        ||           d S )Nr:   2   r  r  r  c                 .    |                                S rH  )strftime)rX   r  s    r$   rL  zdTestToDatetimeInferFormat.test_to_datetime_infer_datetime_format_consistent_format.<locals>.<lambda>F  s    ajj.E.E r&   rD   r   )r   r   r]   r   r2   r_   )r4   r%   r  ra   s_as_dt_stringswith_formatwithout_formats     `    r$   8test_to_datetime_infer_datetime_format_consistent_formatzRTestToDatetimeInferFormat.test_to_datetime_infer_datetime_format_consistent_format>  s}     Z
BSAAABB))$E$E$E$EFF!/+USSS$_EBBB 	{N;;;;;r&   c                     g d}t          t          j        |                    }dt           d}t	          j        t          |          5  t          ||           d d d            d S # 1 swxY w Y   d S )N)01/01/2011 00:00:00z01-02-2011 00:00:00z2011-01-03T00:00:00z[^time data "01-02-2011 00:00:00" doesn\'t match format "%m/%d/%Y %H:%M:%S", at position 1. r	  ri   r   )r   r.   r/   r  rl   rm   rn   r   )r4   r%   r   ra   r   s        r$   $test_to_datetime_inconsistent_formatz>TestToDatetimeInferFormat.test_to_datetime_inconsistent_formatO  s    TTTRXd^^$$G4CG G G 	 ]:S111 	* 	*5))))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*s   A++A/2A/c                     g d}t          t          j        |                    }t          ||          }t          g dd          }t	          j        ||           d S )N)zJan/01/2011zFeb/01/2011zMar/01/2011r   )
2011-01-01z
2011-02-01z
2011-03-01r  r+   )r   r.   r/   r   r2   r_   )r4   r%   r   ra   r6   r7   s         r$   "test_to_datetime_consistent_formatz<TestToDatetimeInferFormat.test_to_datetime_consistent_formatY  so    <<<RXd^^$$S...666>N
 
 
 	vx00000r&   c                    t          t          j        dt          j        dt          j        gt                              }t          ||          }t          dt          dt          gd          }t          j        ||           d S )Nr  01/03/2011 00:00:00r+   r   r  
2011-01-03r  	r   r.   r/   rk   r0   r   r   r2   r_   r{   s        r$   !test_to_datetime_series_with_nansz;TestToDatetimeInferFormat.test_to_datetime_series_with_nansb  s    H&0ErvN  
 
 S...3c2:J
 
 
 	vx00000r&   c           	         t          t          j        t          j        t          j        dddgt                              }t          ||          }t          t          t          dddgd	          }t          j        ||           d S )
Nr  z01/02/2011 00:00:00r  r+   r   r  z
2011-01-02r  r  r  r{   s        r$   'test_to_datetime_series_start_with_nanszATestToDatetimeInferFormat.test_to_datetime_series_start_with_nanso  s    HFF))) 	 	 	
 
 S...#|\<@HX
 
 
 	vx00000r&   ztz_name, offset))r   r   )zUTC-3   )zUTC+3iLc                    t          d| g          }t          |          }t          t          |                    }t          t	          d                              |          g          }t          j        ||           d S )Nz2019-02-02 08:07:13 r   2019-02-02 08:07:13)r   r   r   r   r   rC  r2   r_   )r4   tz_namer  ra   r6   r   r7   s          r$   "test_infer_datetime_format_tz_namez<TestToDatetimeInferFormat.test_infer_datetime_format_tz_name  s     6W66788S!!i///009%:;;GGKKLMM
vx00000r&   z
ts,zero_tz))r  Z)r  r  )2019-02-02 08:07:13.012345r   )r!  r  c                     t          ||z   g          }t          |          }|dk    rt          j        nd }t          t	          ||          g          }t          j        ||           d S )Nr   r   )r   r   r  r  r   r2   r_   )r4   r  zero_tzra   r6   r   r7   s          r$   "test_infer_datetime_format_zero_tzz<TestToDatetimeInferFormat.test_infer_datetime_format_zero_tz  sm     b7l^$$S!! CTXXT9RB///011
vx00000r&   rE   Nr   c                     t          g d          }t          t          d          t          d          t          d          g          }t          |||          }t          j        ||           d S )N)2014-1-1z2014-2-2z2015-3-3z
2014-01-01z
2014-02-02z
2015-03-03rD   r  )r4   r%   rE   ra   r7   r6   s         r$   %test_to_datetime_iso8601_noleading_0sz?TestToDatetimeInferFormat.test_to_datetime_iso8601_noleading_0s  s|     999::,'','',''
 
 Su===
vx00000r&   c                     t          j        t          d          5  t          dgd           d d d            d S # 1 swxY w Y   d S )Nz2The argument 'infer_datetime_format' is deprecatedri   z
10-10-2000T)infer_datetime_format)r2   r   r>  r   r  s    r$   .test_parse_dates_infer_datetime_format_warningzHTestToDatetimeInferFormat.test_parse_dates_infer_datetime_format_warning  s    'F
 
 
 	D 	D dCCCC		D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	Ds   <A A )r  r  r  rl   r  r  r  r  r  r  r  r  r$  r'  r*  rT   r&   r$   r  r  =  sO       [SSS < < <* * *1 1 11 1 11 1 1( [555 1 1	 1 [	
 	
 	
 1 1 1 [Xj'9::1 1 ;:1D D D D Dr&   r  c                   |   e Zd Zej                            dddgddgddgddgg          d             Zd Zej                            d	ddd
e dfddd
e dfddde dfddde dfddd
e dfddd
e dfg          d             Z	ej                            dddgddgddgddgg          d             Z
dS )TestDaysInMonthr  
2015-02-29Nr   z
2015-02-32z
2015-04-31c                 J    t          t          |d||                    sJ d S )Nr   rz   rE   r%   )r   r   )r4   r%   rM   rE   s       r$   test_day_not_in_month_coercez,TestDaysInMonth.test_day_not_in_month_coerce  s/     KHV5QQQRRRRRRRr&   c                     d}t          j        t          |          5  t          dd|           d d d            d S # 1 swxY w Y   d S )Nz8day is out of range for month: 2015-02-29, at position 0ri   r-  ry  r  r_  r&  s      r$   test_day_not_in_month_raisez+TestDaysInMonth.test_day_not_in_month_raise  s    H]:S111 	C 	CWEBBBB	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	Cr  zarg, format, msgz/^day is out of range for month, at position 0. r	  z
2015-29-02r   zS^unconverted data remains when parsing with format "%Y-%m-%d": "2", at position 0. z
2015-32-02zH^time data "2015-32-02" doesn't match format "%Y-%d-%m", at position 0. z
2015-31-04c                     t          j        t          |          5  t          |d||           d d d            d S # 1 swxY w Y   d S )Nri   ry  r/  r_  )r4   r%   rM   rE   r   s        r$   !test_day_not_in_month_raise_valuez1TestDaysInMonth.test_day_not_in_month_raise_value  s    N ]:S111 	I 	IGF%HHHH	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	Ir,  zexpected, formatc                 <    t          |d||          }||k    sJ d S )Nrx   r/  r   )r4   r%   r7   rE   r6   s        r$   test_day_not_in_month_ignorez,TestDaysInMonth.test_day_not_in_month_ignore  s1     XhvUSSS!!!!!!r&   )r  r  r  rl   r  r  r0  r2  r  r4  r6  rT   r&   r$   r,  r,    s        [4 :&:&:&		
 S S SC C C
 [ T/TTT T/TTT 5"15 5 5 5"15 5 5 T/TTT T/TTT9!	
$ $JI IK$ $JI
 [4 :&:&:&		
 " " " " "r&   r,  c                   v   e Zd Zej                            dg d eddd          fd eddd          fd eddd          fd	 eddd          fd
 eddd          fd eddd          fd eddd          fd eddd          fd eddd          fd eddd          fd eddd          fd eddd          fd eddd          fd eddd          fd eddd          fd eddd          fd eddd          fd eddd          fd eddd          fd eddd          fd eddd          fd eddd          fd  eddd          fd! eddd          fd" ed#d$d          fd% eddd&          fd' eddd&dd(          fd) eddd&d*d+          fd, eddd&dd(          fd- eddd&d*d+          fd. eddd&dd(          fd/ eddd&dd(d0          fd1 eddd&dd(d0          fd2 eddd&d3d(d0          fd4 eddd&d*d+          fd5 ed6d&d7dd8d9          fd: ed6d&d7          fd; ed6d&d7          fd< ed=dd          fd> ed=d?d          fd@ ed=d?d          fdA ed=d?d          fdB ed=d?d          fdC edDdddE          fdF edDdddEdG          fdH edDdddEdGdI          f          dJ             ZdK ZdL Z	ej                            dMdNdOdO edPdd          fdNdQdO edPdd          fdNdOdQ edRddE          fdNdQdQ edRdEd          fdSdOdO edTdEdU          fdSdQdO edTdEdU          fdSdOdQ ed#dEdV          fdSdQdQ ed#dEdV          fg          dW             Z
ej                            dXdY eddddd(          gdZ edddd&d$          gg          d[             Zej                            d\d] e ed^_                    d`fda e edb_                    dcfg          dd             ZdeS )fTestDatetimeParsingWrapperszdate_str, expectedr  i  r   2Q2005i  r   2Q052005Q105Q12011Q3r  11Q33Q20113Q112000Q4r   r   00Q44Q20004Q002000q4z2000-Q4z00-Q4z4Q-2000z4Q-0000q42005z2005-11ru  z2005 11z11-2005z11 2005200511r)  rR   20051109	   z20051109 10:15r  z20051109 08H   r   z2005-11-09 10:15z2005-11-09 08Hz2005/11/09 10:15z2005/11/09 10:15:32    z2005/11/09 10:15:32 AMz2005/11/09 10:15:32 PM   z2005/11/09 08HzThu Sep 25 10:36:28 2003i     $      zThu Sep 25 2003zSep 25 2003zJanuary 1 2014re  z2014-06r  z06-2014z2014-6z6-2014z20010101 12r   r   z20010101 1234r   z20010101 123456r   c                 |   d}t          j        ||          \  }}t          ||          }t          |g|          }t          t          j        |gt
                    ||          }	t          |g|          }
t          t          |g          |          }t          t          |g          |          }||fD ]
}||k    sJ ||	|
||fD ]4}t          t          |          g          }t          j        ||           5|s2t          |          }||k    sJ t          |dd|          }||k    sJ d S d S )NT)	yearfirstr+   )rR  r%   Sr   )r  r  rR  )r   parse_datetime_string_with_resor   r.   r/   r0   r   r   r   r   r2   r3   r   )r4   r  r7   r%   rR  r  _r6  r7  r8  result6result8result9r&  r   result5result7s                    r$   test_parsersz(TestDatetimeParsingWrappers.test_parsers  s   p 	<	
 
 

 h)<<<xjI>>>HhZv...)5
 
 
  
i@@@xj 1 1YGGGz 2 2iHHHW% 	# 	#C(?????Wgw@ 	, 	,C8!4!4 566C!#s++++  	'))Gh&&&& Q)TTTGh&&&&		' 	' '&r&   c                     t          t          t          gd          }t          ||g|          }t          j        ||           d S )Nr  r+   r   )r   r   r   r2   r3   )r4   r%   unique_nulls_fixtureunique_nulls_fixture2r7   r6   s         r$   test_na_values_with_cachez5TestDatetimeParsingWrappers.test_na_values_with_cacheY  sN     #s+;<<<24IJRWXXX
fh/////r&   c                     t          j        d          \  }}t          d          }t          d          }t	          dg          d         }|t
          u sJ |t
          u sJ |t
          u sJ |t
          u sJ d S )Nr   r   )r   rT  r   r   r   r   )r4   r  rU  r6  r7  r8  s         r$   test_parsers_natz,TestDatetimeParsingWrappers.test_parsers_nata  s|    <UCC
e$$E""((+#~~~~#~~~~#~~~~#~~~~~~r&   z'date_str, dayfirst, yearfirst, expectedz10-11-12Fr   Ti  z20/12/21i  rV     c                 ,   t          |||          }||k    sJ t          j        |||          \  }}|s|st          |          }	|	|k    sJ t	          ||||          }
t          |g||          d         }||k    sJ |
|k    sJ ||k    sJ d S )N)r~  rR  )r~  rR  r%   r   )r
   r   rT  r   r   r   )r4   r%   r  r~  rR  r7   dateutil_resultr  rU  r6  r7  r8  s               r$   test_parsers_dayfirst_yearfirstz;TestDatetimeParsingWrappers.test_parsers_dayfirst_yearfirstl  s    v  8yQQQ(****<x9
 
 


  	'	 	'))Gh&&&&x9E
 
 
  
XSSSTUV(""""(""""(""""""r&   zdate_str, exp_defz10:15z9:05c                 *   t          |          }t          j        |          \  }}t          |          }t          |g          }t	          |          }t          |g          d         }	||k    sJ ||k    sJ ||k    sJ ||k    sJ |	|k    sJ d S )Nr   )r
   r   rT  r   r   r   )
r4   r  exp_defexp_nowr  rU  r6  r7  r8  rY  s
             r$   test_parsers_timestringz3TestDatetimeParsingWrappers.test_parsers_timestring  s     //<XFF
h''xj))H%%
++A. '!!!!'!!!!'!!!!'!!!!'!!!!!!r&   zdt_string, tz, dt_string_reprz2013-01-01 05:45+0545iY  r   z5Timestamp('2013-01-01 05:45:00+0545', tz='UTC+05:45')z2013-01-01 05:30+0530iJ  z5Timestamp('2013-01-01 05:30:00+0530', tz='UTC+05:30')c                     t          d|          }|                    d                              |          }t          ||          }||k    sJ |t          |          k    sJ d S )Nz2013-01-01 00:00:00r   r   )r   rC  r-  repr)r4   r%   	dt_stringr   dt_string_reprr  dt_times          r$   .test_parsers_timezone_minute_offsets_roundtripzJTestDatetimeParsingWrappers.test_parsers_timezone_minute_offsets_roundtrip  st    & 0>>>&&11"55iu555wg......r&   N)r  r  r  rl   r  r  r   r[  r_  ra  re  ri  r   r   ro  rT   r&   r$   r8  r8    s       [1	
88D!Q//01	
xxa++,1	
 XXdAq))*1	
 xxa++,	1	

 XXdAq))*1	
 xxa++,1	
 XXdAq))*1	
 xxa++,1	
 XXdAq))*1	
 xxb!,,-1	
 XXdB**+1	
 xxb!,,-1	
 XXdB**+1	
 xxb!,,-1	
  r1--.!1	
" hhtR++,#1	
$ r1--.%1	
& hhtR++,'1	
( XXdB**+)1	
* XXdAq))*+1	
, r1--.-1	
. r1--./1	
0 r1--.11	
2 r1--.31	
4 xxa,,-51	
6 $A../71	
8 xxb!R<<=91	
: XXdB1a889;1	
<  $Ar2!>!>?=1	
> xxb!Q::;?1	
@  $Ar2!>!>?A1	
B #HHT2q"b"$E$EFC1	
D &xxb!RR'H'HIE1	
F &xxb!RR'H'HIG1	
H xxb!Q::;I1	
J ($2r2r)J)JKK1	
L q" 5 56M1	
N HHT1b112O1	
P xxa334Q1	
T q!,,-U1	
V q!,,-W1	
X xxa++,Y1	
Z xxa++,[1	
\ HHT1a445]1	
^ hhtQ2r::;_1	
` q!RR @ @Aa1	
4 4j' 'k4 4j'@0 0 0	 	 	 [1xxb"'='=>uhhtR&<&<=hhtR&<&<=tXXdB%;%;<xxb"'='=>uhhtR&<&<=hhtR&<&<=tXXdB%;%;<		
 B# B# B#H [
88Aq!R,,	-Aq!Q8O8O/PQ " "	 "$ [' (3///00G (3///00G	
 / / / / /r&   r8  )r  ri  r  r  r  c                     | j         S )zIDay and some time units.

    * D
    * s
    * ms
    * us
    * ns
    r    r"   s    r$   unitsrq    s     =r&   c                       t          d          S )zTimestamp at 1960-01-01.
1960-01-01rU   rT   r&   r$   
epoch_1960rt    s     \"""r&   c                  :    t          t          d                    S )NrR   )r  r  rT   r&   r$   units_from_epochsrv     s    a>>r&   )r  
pydatetimer  str_1960c                     |j         dv sJ |j         dk    r| S |j         dk    r|                                 S |j         dk    r|                                 S t          |           S )zxTimestamp at 1960-01-01 in various forms.

    * Timestamp
    * datetime.datetime
    * numpy.datetime64
    * str
    >   rx  r  r  rw  r  rw  r  )r!   rJ  to_datetime64r^   )rt  r#   s     r$   epochsr{    su     =QQQQQ}##	,	&	&'')))	,	&	&''))):r&   c                  R    t          dd                                          j        S )Nr&  r   r  )r   to_julian_daterH   rT   r&   r$   julian_datesr~    s$    j"---<<>>EEr&   c                      e Zd Zd Zd Zd Zd Zd Zej	        
                    dddg          d	             Zej	        
                    d
 eddd           eddd          d ej        d          g          d             Zej	        
                    ddefdefdef eddd          efg          d             Zd Zd Zej	        
                    ddefddg          d             Zej	        
                    dg dg dg dg          d             Zej	        
                    d g d!g d"g d#g d$g          d%             ZdS )&
TestOriginc                     t          ddd          }t          d          }||k    sJ t          ddd          }t          d          }||k    sJ d S )Nr   ri  r  z1970-01-01 00:00:02i ʚ;z2001-09-09 01:46:41rL   )r4   r  r7   s      r$   test_origin_and_unitzTestOrigin.test_origin_and_unit  sd    Q///233X~~~~];;;233X~~~~~~r&   c                     t          t          |dd                    }t          t          |t          d                                          z
  d                    }t	          j        ||           d S )Nr  julianr  r   r  )r   r   r   r}  r2   r_   )r4   r~  r6   r7   s       r$   test_julianzTestOrigin.test_julian)  sq     Ls8LLLMMy||'B'B'D'DD3OOO
 
 	vx00000r&   c                     t          t          g ddd                    }t          t          d          t          d          t          d          gd	          }t          j        ||           d S )
N)r   r   rg   r  r  r  z
1970-01-01r  r  r   r+   r  r   s      r$   	test_unixzTestOrigin.test_unix3  sv    IIICGGGHH|$$i&=&=y?V?VW
 
 
 	vx00000r&   c                     t          ddd          }|                                dk    sJ d}t          j        t          |          5  t          ddd           d d d            d S # 1 swxY w Y   d S )NiR|% r  r  r  r  z&1 is Out of Bounds for origin='julian'ri   r   )r   r}  rl   rm   rn   )r4   r6   r   s      r$   test_julian_round_tripz!TestOrigin.test_julian_round_trip;  s    WXC@@@$$&&'1111 7]:S111 	6 	6(5555	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6r}  c                     |dk    rJd}t          j        t          |          5  t          ||d           d d d            d S # 1 swxY w Y   d S d S )Nr  z$unit must be 'D' for origin='julian'ri   r  r  r_  )r4   rq  r~  r   s       r$   test_invalid_unitzTestOrigin.test_invalid_unitD  s    C<<8Cz555 G GLuXFFFFG G G G G G G G G G G G G G G G G G <s   AAAr  r  r  c                     d}t          j        t          |          5  t          dd|           d d d            d S # 1 swxY w Y   d S )Nz(it must be numeric with a unit specifiedri   z
2005-01-01rs  r  r_  )r4   r  r   s      r$   test_invalid_originzTestOrigin.test_invalid_originK  s     9]:S111 	F 	F\EEEE	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	Fr  r{    r   rs  c                    t          ddd          t          j        dt          j                  }t	          fd|D                       }t	          t          ||                    }t          j        ||           d S )Nr  r   rR   r+   c                 B    g | ]}t          j        |           z   S )r  )r   	Timedelta)rW   rX   rt  rq  s     r$   rY   z)TestOrigin.test_epoch.<locals>.<listcomp>_  s-    QQQ!R\!%(((:5QQQr&   r  )r   r.   r  r  r   r   r2   r_   )r4   rq  r{  rv  r7   r6   rt  s    `    @r$   
test_epochzTestOrigin.test_epochR  s     tQ**
Iarx888QQQQQ?PQQQ
 
 $5E&QQQRR
vx00000r&   zorigin, excr  r  z
13-24-1990c                     d                     d| dd| ddg          }t          j        ||          5  t          |||           d d d            d S # 1 swxY w Y   d S )Nr  zorigin z is Out of Boundsz# cannot be converted to a Timestampz,Cannot cast .* to unit='ns' without overflowri   r  )r  rl   rm   r   )r4   r  excrq  rv  r   s         r$   test_invalid_originszTestOrigin.test_invalid_originse  s     hh3&333E&EEE>
 
 ]3c*** 	F 	F)fEEEE	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	Fs   AAAc                     t          j        t          d          5  t          ddt	          dddt
          j                             d d d            d S # 1 swxY w Y   d S )Nzmust be tz-naiveri   r   r  r   r   r  )rl   rm   rn   r   r   r  r  r  s    r$   test_invalid_origins_tzinfoz&TestOrigin.test_invalid_origins_tzinfoy  s    ]:-?@@@ 	S 	SHT1a,Q,Q,QRRRR	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	Ss   .AAAc                     d}t          j        t          |          5  t          ddg           d d d            d S # 1 swxY w Y   d S )NzIUnknown datetime string format, unable to parse: yesterday, at position 1ri   r  	yesterdayr_  r  s     r$   test_incorrect_value_exceptionz)TestOrigin.test_incorrect_value_exception~  s     X 	 ]:S111 	0 	0+.///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0r]  zformat, warningN)r   N)r   Nc                     d}t          j        t          |          5  t          d|           d d d            d S # 1 swxY w Y   d S )NzG^Out of bounds nanosecond timestamp: 2417-10-10 00:00:00, at position 0ri   z2417-10-10 00:00:00r   r  )r4   rE   r  r   s       r$   .test_to_datetime_out_of_bounds_with_format_argz9TestOrigin.test_to_datetime_out_of_bounds_with_format_arg  s     Y].c::: 	> 	>-f====	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>r]  zarg, origin, expected_str)( r  z2169-11-13 00:00:00)r  
1870-01-012069-11-13 00:00:00)鼫 r  2169-10-20 00:00:00c                     t          |d|          }t          |          }||k    sJ t          ddd          }t          d          }||k    sJ t          ddd          }t          d          }||k    sJ d S )Nr  r  r  r  r  r  r  rL   )r4   rM   r  expected_strr6   r7   s         r$   test_processing_orderz TestOrigin.test_processing_order  s     Ss6:::\**!!!!YSFFF233!!!!YSFFF233!!!!!!r&   zoffset,utc,exp)r   T2019-01-01T00:00:00.000Z)r   Nr  )-01:00Tz2019-01-01T01:00:00.000Z)r  Nz2019-01-01T00:00:00.000-01:00c                     d|z   }t          |gd|          }t          |g                              d          }t          j        ||           d S )Nz2019-01-01T00:00:00.000r  )r  r  )r   r  r2   r3   )r4   r  r  r   rM   r6   r7   s          r$   test_arg_tz_ns_unitzTestOrigin.test_arg_tz_ns_unit  sZ     (&0cU3777u%%--d33
fh/////r&   )r  r  r  r  r  r  r  r  rl   r  r  r  r   r   r.   r  r  rn   r   r  r  r  r>  r  r  r  rT   r&   r$   r  r    s         1 1 11 1 16 6 6G G G [VdC[11F F 21F [IdAq!!HT1a  BM,''		
 1 1 1 [j)j!:&XaA 34		
 	F 	F 	FS S S
0 0 0 [;''	
 > > > [#666<<<<<<	
 " " "  [333333888===		
 0 0 0 0 0r&   r  c            
       v   e Zd Zej                            dg ddfg ddfg          d             Zej                            ddd	g          d
             Zej                            d e e	d          gdz             e	d          gdz   e
 e	d          gdz            g          d             ZdS )TestShouldCachezlistlike,do_caching)
r   rg   r   r   rR   r  r  rK  rJ  r   F)
r   r   r   r   r   rR   r  r  rK  rJ  Tc                 Z    t          j        |t          |          d          |k    sJ d S )Ngffffff?)check_countunique_share)r  should_cacher=  )r4   listlike
do_cachings      r$   test_should_cachez!TestShouldCache.test_should_cache  sA     xS]]QTUUU     r&   z%unique_share,check_count, err_message)g      ?ru  z5check_count must be in next bounds: \[0; len\(arg\)\])r   rg   z-unique_share must be in next bounds: \(0; 1\)c                     dgdz  }t          j        t          |          5  t          j        |||           d d d            d S # 1 swxY w Y   d S )NrR   r   ri   )rl   rm   AssertionErrorr  r  )r4   r  r  err_messagerM   s        r$   test_should_cache_errorsz(TestShouldCache.test_should_cache_errors  s     cBh]>=== 	? 	?sL+>>>	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?s   AA
A
r  rH  rI  c                 6    t          j        |          du sJ d S )NT)r  r  )r4   r  s     r$   &test_no_slicing_errors_in_should_cachez6TestShouldCache.test_no_slicing_errors_in_should_cache  s&     !(++t333333r&   N)r  r  r  rl   r  r  r  r  r   r   r  r  rT   r&   r$   r  r    s2       [+++U3+++T2	
 
 
 
 [/OE	
 ? ? ? [UII3445:;;i-../"4UII3445:;;	
 4 4 4 4 4r&   r  c            	         t          g d          } |                     d          } |                                 }t          | d          }t          t	          j        d          t	          j        d          t	          j        d          t	          j        d          t	          j        d          g          }t          j        ||           t          j        | |           d S )	N)r   rg   Nl            NInt64r  r  z1970-01-01 00:00:00.000000001z1970-01-01 00:00:00.000000002r   z2043-01-25 23:56:49.213693952)r   r  r1  r   r.   r  r2   r_   )ra   ser_copyr&  r7   s       r$   !test_nullable_integer_to_datetimer    s    
***
+
+C
**W

CxxzzH
c
%
%
%CM9::M9::M%  M9::M%  	
 H 3)))3)))))r&   r  c                 "   t          | t                    rOt          j        t          d          5  t           || g                     d d d            d S # 1 swxY w Y   d S t           || g                    }|d         t          u sJ d S )Nznot convertible to datetimeri   r   )r%  r   rl   rm   r!  r   r   )nulls_fixturer  r6   s      r$   test_na_to_datetimer    s    -))  ]9,IJJJ 	0 	0}o..///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 UUM?3344ayCs   AAArz   rx  zargs, format)z
03/24/2016z
03/25/2016r  r=   )
2016-03-24
2016-03-25r  r   r;  r:  r<  c                     t          |          }t          |||           }t          ddt          gd          }t          j        ||           d S )Nr   r  r  r  r+   )r   r   r   r2   r_   )rz   rO  rE   r  r6   r7   s         r$   test_empty_string_datetimer    sX     
B F6:::F|\37?OPPPH8V,,,,,r&   c                      t          ddgdd          } t          ddgd	          }t          j        ||            t          ddgdd
          } t          j        ||            d S )Nr   r  ri  r   r  r  r   r  r+   ry  r  r6   r7   s     r$   'test_empty_string_datetime_coerce__unitr    s{     !Rs8<<<F3U;CSTTTH(F+++ !Rs7;;;F(F+++++r&   r%   c                    t           }t          t          d          |d          }|                    dd                              |d          }|j                                                            t                    d	z  |_        t          |j
        d d d
f         |           }|j
        d d d
f         }t          j        ||           d S )N1980YSr  FDTr  r   )nrandom_statei  r   r   )r   r   r   to_framesampler  	to_seriesr  rd   r   rc  r2   r_   )r%   cstarttimesr6   r7   s        r$   +test_to_datetime_monotonic_increasing_indexr  &  s     Fy((&tDDDENNTN2299FQR9SSE+''))0077$>EKAAAqD)777Fz!!!Q$H68,,,,,r&   series_length(   r   rR   c                 z   t          t          j        d          gt          j        d          g| z  z   t                    }t	          |dd          }t          t
          gt          d          g| z  z             }t          j        ||           t	          |dd          }t          t          j        d          gt          j        d          g| z  z             }t          j        ||           t          j
        t          d	          5  t	          |d
d           d d d            d S # 1 swxY w Y   d S )Nz1446-04-12 00:00:00+00:00z1991-10-20 00:00:00+00:00r+   r   T)rz   r  rx   r  ri   ry  )r   r   fromisoformatr0   r   r   r   r2   r_   rl   rm   r   )r  ra   r  	expected1r6  r  s         r$   2test_to_datetime_cache_coerce_50_lines_outofboundsr  2  s    		 ;	<	<="#>??@=P	R  C
 #hD999G	)7889MIJ I 7I...#hD999G		 ;	<	<="#>??@=P	R I
 7I...	*2V	W	W	W 3 3CT22223 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3s   D00D47D4c            
      n    d} d}t          | |          }t          ddddddd	d
          }||k    sJ d S )Nz15/02/2020 02:03:04.123456789z%d/%m/%Y %H:%M:%S.%fr   r)  rg   r  r   r   r   i  )r  r  r  r  r  r  microsecond
nanosecondrL   )r  timestamp_formatr6   r7   s       r$   %test_to_datetime_format_f_parse_nanosr  R  se    /I-+;<<<F	 	 	H Xr&   c                  x    t          ddgd          } t          ddg          }t          j        | |           d S )Nr?  z2020-01-01 05:00:00r:  r   rf  r  r  s     r$   test_to_datetime_mixed_iso8601r  d  sG    ,(=>yQQQF35JKLLH&(+++++r&   c                  x    t          ddgd          } t          ddg          }t          j        | |           d S )Nz
01/11/2000z12 January 2000r3  r   z
2000-01-11z
2000-01-12r  r  s     r$   test_to_datetime_mixed_otherr  k  sE    ,(9:7KKKFlL9::H&(+++++r&   r   rE   r3  c                     d}t          j        t          |          5  t          dg| |           d d d            d S # 1 swxY w Y   d S )Nz8Cannot use 'exact' when 'format' is 'mixed' or 'ISO8601'ri   r?  )r   rE   r_  )r   rE   r   s      r$   #test_to_datetime_mixed_or_iso_exactr  r  s     EC	z	-	-	- @ @\N%????@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @r  c                      t          j        t          d          5  t          ddgd           d d d            d S # 1 swxY w Y   d S )Nz9Time data 01-01-2000 is not ISO8601 format, at position 1ri   r?  
01-01-2000r:  r   r_  rT   r&   r$   4test_to_datetime_mixed_not_necessarily_iso8601_raiser  z  s    	U
 
 
 D D 	\<0CCCCD D D D D D D D D D D D D D D D D Dr,  )rz   r7   r   rf  rx   r?  r  r^   r+   c                 X    t          ddgd|           }t          j        ||           d S )Nr?  r  r:  r   r   )rz   r7   r6   s      r$   5test_to_datetime_mixed_not_necessarily_iso8601_coercer    s7     ,5iPVWWWF&(+++++r&   c                  ^   d} d}t          j        t          |          5  t          |           }d d d            n# 1 swxY w Y   |t          | d d                   k    sJ t          j        t                    5  t	          |           }d d d            n# 1 swxY w Y   |t	          | d d                   k    sJ t          j        t                    5  t	          | g          }d d d            n# 1 swxY w Y   t          j        |t	          | d d         g                     d S )Nz2014 Jan 9 05:15 FAKEzLun-recognized timezone "FAKE". Dropping unrecognized timezones is deprecatedri   )r2   r   r   r   r   r3   )dtstrr   r&  s      r$   #test_ignoring_unknown_tz_deprecatedr    s   #E
XC		#M	=	=	=                )E#2#J''''''		#M	2	2 ! !%  ! ! ! ! ! ! ! ! ! ! ! ! ! ! !+eCRCj))))))		#M	2	2 # #5'""# # # # # # # # # # # # # # ##{E#2#J<8899999s3   <A A =BB BC77C;>C;c                     t          j        d           t          ddg|                                  d          }t	          |          }t          ddgd          }t          j        ||           d S )Nr  r   rg   z	[pyarrow]r+   r  )rl   r  r   lowerr   r2   r_   )any_numeric_ea_dtypera   r6   r7   s       r$   test_from_numeric_arrow_dtyper    s|    
	"""
!Q"6"<"<">">III
J
J
JCFq!f$4555H68,,,,,r&   c                  *   ddg} t          | d          }t          t          d          dgd          }t          j        ||           t          |           }t          j        ||           t          |           }t          j        ||           d S )N2020-01-01 00:00+00:00r  r3  r   r   r  r+   )r   r   r   r2   r3   r   )r5  r6   r7   r  alt2s        r$   6test_to_datetime_with_empty_str_utc_false_format_mixedr    s    $b)Dg...Fi 8995AWWWH&(+++ d

C#x(((D$)))))r&   c                      d} t          j        t          |           5  t          g dd           d d d            d S # 1 swxY w Y   d S )Nr   ri   )r  z2020-01-01 00:00+02:00r  r3  r   r  )r   s    r$   Btest_to_datetime_with_empty_str_utc_false_offsets_and_format_mixedr    s    
GC		#M	=	=	= 
 
DDDW	
 	
 	
 	

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
r  c                     t          dd          } d}| |g}d}t          j        t          |          5  t	          |           d d d            n# 1 swxY w Y   t          j        t          |          5  t	          |d           d d d            n# 1 swxY w Y   t          j        t          |          5  t          |           d d d            d S # 1 swxY w Y   d S )	Nz2016-01-02 03:04:05r   r   z2023-10-30 15:06+01zsMixed timezones detected. pass utc=True in to_datetime or tz='UTC' in DatetimeIndex to convert to a common timezoneri   r3  r   )r   rl   rm   rn   r   r   )r  r  r5   r   s       r$   &test_to_datetime_mixed_tzs_mixed_typesr    s    
(\	:	:	:B!Eu+C	;  
z	-	-	-  C              	z	-	-	- ) )C(((() ) ) ) ) ) ) ) ) ) ) ) ) ) )	z	-	-	-  c                 s5   AAA7BBB;CCCc                     d} t          |           }|| g}t          |          }t          |d d d                   d d d         }t          |d          }t          |          }t          ||g          }t          j        ||           t          j        ||           t          j        ||           t          j        ||           d S )Nz2023-11-01 09:22:03-07:00r4  r3  r   r  )r  r  r5   r  r  res3res4r7   s           r$   )test_to_datetime_mixed_types_matching_tzsr    s    'E	5		Bu+CsDs44R4y!!$$B$'Ds7+++DDb"X&&H$)))$)))$)))$)))))r&   r  z)ignore:Could not infer format:UserWarning	aware_valc                 *    t          |           j        S rH  r%  r  rK  s    r$   rL  rL        $q''" r&   	naive_valic                 *    t          |           j        S rH  r  rK  s    r$   rL  rL    r   r&   naive_firstc                    | |dg}|}|r|| dg}t          | t                    ot          |t                    }t          |t          t          f          }d}t	          d |D                       }t          |t                    sd}	|rot          | t
                    rZt          |t
                    rd}	t          j        t          |	          5  t          |           d d d            n# 1 swxY w Y   nBt          j        t          |	          5  t          |           d d d            n# 1 swxY w Y   t          |d           nz|r|
                    |           |
                    |          k     rd	}	t          j        t          |	          5  t          |           d d d            n# 1 swxY w Y   t          j        t          |	          5  t          |d           d d d            n# 1 swxY w Y   n|r|
                    |           |
                    |          k     rd
}	t          j        t          |	          5  t          |           d d d            n# 1 swxY w Y   t          j        t          |	          5  t          |d           d d d            n# 1 swxY w Y   n
|r|
                    |          |
                    |           k     rd}	t          j        t          |	          5  t          |           d d d            n# 1 swxY w Y   t          j        t          |	          5  t          |d           d d d            n# 1 swxY w Y   nSt          j        t          |          5  t          |           d d d            n# 1 swxY w Y   t          |d           |rt          j        t          |          5  t          |d           d d d            n# 1 swxY w Y   t          j        t          |          5  d}	t          j        t          |	          5  t          |           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S d}	|rt          | t
                    rt          |t
                    rd}	t          j        t          |	          5  t          |d           d d d            n# 1 swxY w Y   t          j        t          |	          5  t          |           d d d            d S # 1 swxY w Y   d S t          j        t          |	          5  t          |d           d d d            n# 1 swxY w Y   t          j        t          |	          5  t          |           d d d            d S # 1 swxY w Y   d S )Nr  zFIn a future version of pandas, parsing datetimes with mixed time zonesc              3   &   K   | ]}|d k    |V  dS )r  NrT   rV   s     r$   r|  z?test_to_datetime_mixed_awareness_mixed_types.<locals>.<genexpr>  s&      44AGG!GGGG44r&   z(Cannot mix tz-aware with tz-naive valuesz<Tz-aware datetime.datetime cannot be converted to datetime64ri   Tr  z!time data .* doesn't match formatz3time data \"2020-01-01 00:00\" doesn't match formatz1unconverted data remains when parsing with formatr3  r   z!DatetimeIndex has mixed timezones)r%  r^   r  rd   nextr   rl   rm   rn   r   r  r2   r   r   r!  r   )
r  r  r  r5  vec	both_strshas_numericr  first_non_nullr   s
             r$   ,test_to_datetime_mixed_awareness_mixed_typesr    s	    y"%D
C ))R( 9c**Iz)S/I/IIYe55KWH44S44444N nc** )#8 	!:i;; 	!)Y// UTz555 ! !C   ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! z555 ! !C   ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! 	CT"""""	 #9--		)0D0DDD1]:S111 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	]:S111 	' 	'&&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 
 #syy++cii	.B.BBBD]:S111 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	]:S111 	' 	'&&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 
 #syy++cii	.B.BBBA]:S111 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	]:S111 	' 	'&&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 'XFFF 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	CT"""" #'XFFF 	- 	-G,,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-'XFFF 	# 	#5Cy444 # #c"""# # # # # # # # # # # # # # #	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	#
 9 	#:i;; 	#)Y// UTz555 1 1C00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1z555 # #c"""# # # # # # # # # # # # # # # # # # z555 1 1C00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1z555 # #c"""# # # # # # # # # # # # # # # # # #s2  C,,C03C0D//D36D3F44F8;F8G88G<?G<I,,I03I0J00J47J4L$$L(+L(
M((M,/M,N++N/2N/$PP	P(Q:Q"Q:"Q&	&Q:)Q&	*Q::Q>Q>S00S47S4T33T7:T7U99U= U=V<<W W )h__doc__r   collectionsr   r   r   r   r   decimalr   r  dateutil.parserr
   dateutil.tz.tzr   numpyr.   rl   r  pandas._libsr   pandas._libs.tslibsr   r   pandas.errorsr   r   pandas.util._test_decoratorsutil_test_decoratorsr  pandas.core.dtypes.commonr   pandasr   r   r   r   r   r   r   r   r   r   pandas._testing_testingr2   pandas.core.arraysr   pandas.core.toolsr   r  pandas.core.tools.datetimesr   r  r  r  
pytestmarkrE  r%   r(   r!  r  r	  rG  r  r  r,  r8  rq  rt  rv  r{  r~  r  r  r  r  r/   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rC  r  r   rd   r  rT   r&   r$   <module>r      s	                              ! ! ! ! ! ! # # # # # #                           * ) ) ) ) ) ) ) ) < < < < < <    
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
       , , , , , , 0 0 0 0 0 0 8 8 8 8 8 8  [''8 

 e}%%%  &%s0 s0 s0 s0 s0 s0 s0 s0l{) {) {) {) {) {) {) {)|'o@ o@ o@ o@ o@ o@ o@ o@d	G1 G1 G1 G1 G1 G1 G1 G1Tc* c* c* c* c* c* c* c*L1 1 1 1 1 1 1 1<wD wD wD wD wD wD wD wDtI" I" I" I" I" I" I" I"Xg/ g/ g/ g/ g/ g/ g/ g/T 333444	 	 54	 # # #
    LLLMMM  NM& F F F\0 \0 \0 \0 \0 \0 \0 \0~%4 %4 %4 %4 %4 %4 %4 %4P* * *, 28T"233    43  #@#@#@AA	)	)	):6	)	)	):6 
	"   - -  BA-	, 	, 	, 4-00- - 10- 	,q04Dq4HJ 3 3	 38  $, , ,, , , 4-00Iw#788@ @ 98 10@D D D 	=="7!=>>?	55,5UCCCD , , ,: : : - - -* * *
 
 
  &* * *" 	!Yu GHH
IIe""   
 
3B3Z%%rwwyy"'28UU28__U""   
 u66S# S# 76   IHS# S# S#r&   