
    o[we             	       H   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Z6 ej7        ddg          d             Z8 G d d          Z9 G d 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$          Z@ G d% d&          ZA ej7        g d'          d(             ZBej7        d)             ZCej7        d*             ZD ej7        g d+          d,             ZEej7        d-             ZF G d. d/          ZG G d0 d1          ZHd2 ZIejJ        K                    d3ejL        eMg          d4             ZNejJ        K                    d5g d6          ejJ        K                    d7g d8d9fg d:d;fgd<d=g>          d?                         ZOd@ ZPejJ        K                    dAddg          dB             ZQejJ        K                    dCdDe5e5dEz   e5dFz   g          dG             ZRdH ZSdI ZTdJ ZUejJ        K                    dKddg          ejJ        K                    dLd=dMg          dN                         ZVdO ZWejJ        K                    dPdQ e$dRe&g          fdS e%dTdUg          fg          dV             ZXdW ZYdX ZZdY Z[dZ Z\dS )[z 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.TF)paramsc                     | j         S )z/
    cache keyword to pass to to_datetime.
    paramrequests    Clib/python3.11/site-packages/pandas/tests/tools/test_to_datetime.pycacher%   =   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_readonlyF   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          |t                    rt          j        ||           d S t          j        ||           d S )N)1/1/20001/2/20001/3/2000formatr%   )r   
isinstancer   r2   assert_series_equalr3   )r4   r%   index_or_seriesrE   r7   valuesr6   s          r$   test_to_datetime_formatz1TestTimeConversionFormats.test_to_datetime_formatP   s     !!E!E!EFFVF%@@@"?8,,h'' 	4"6844444!&(33333r&   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_scalarf   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>x       @@@A9Q<<@@@r&   %Y%m%drD   r   applystrr   r2   rG   r4   r%   serr7   r6   s        r$    test_to_datetime_format_YYYYMMDDz:TestTimeConversionFormats.test_to_datetime_format_YYYYMMDDv   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 )NrQ   rR   rS   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   rG   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 rS   rd   r+   1980120119810101rg   %Y%mrD   )r   r   r.   rk   r   r2   rG   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   rG   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	          j        ||           d S )N1501010120150101r\   rx   ry   )r   r.   rk   r   r2   r3   r4   r%   r6   r7   s       r$   8test_to_datetime_format_YYYYMMDD_ignore_with_outofboundszRTestTimeConversionFormats.test_to_datetime_format_YYYYMMDD_ignore_with_outofbounds   s\    RV,	
 
 
 *j"&9::
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   rG   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   )rQ   T1NrQ   r   )rQ   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   rG   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   rG   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 rU   rV   rW   s     r$   rZ   zMTestTimeConversionFormats.test_to_datetime_format_integer.<locals>.<listcomp>  r[   r&   z%YrD   )iA i i c                 X    g | ]'}t          |d d         dz   |dd          z             (S )N   -rV   rW   s     r$   rZ   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_microsecond9  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 rL   r   )r4   r%   valuerE   dts        r$   test_to_datetime_format_timez6TestTimeConversionFormats.test_to_datetime_format_timeB  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   rG   r{   s        r$   test_to_datetime_with_non_exactz9TestTimeConversionFormats.test_to_datetime_with_non_exactq  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&   rN   )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%   rN   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 rL   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   assert_equal)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   r   )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   rN   r6   r7   s        r$   *test_to_datetime_parse_timezone_keeps_namezDTestTimeConversionFormats.test_to_datetime_parse_timezone_keeps_name5  s`    $,-E:::S--- "7!8UOOO
fh/////r&   )3__name__
__module____qualname__rl   markparametrizer8   r   rJ   rO   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  rU   r&   r$   r(   r(   E   s.       [Z$770 0 870 [ :&&		*(=(=yy?T?TU
 :&&		*(=(=yy?T?TU		
 4 4 4 [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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          d/             Zej                            d& ej
        d eg d0d          d1           ej
        d eg d2d          d3          g          d4             Zej                            dddgddg	          ej                            d5 ej
        dd6gd7          g          ej                            d!ed8 g          d9                                     Zd: Zej                            d;d<d= ed>d?d@dAdA          gdBd= edCdDdDdAdA          gdEd= edCdDdFdAdA          gg          dG             Zej                            dHg dIg 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          ej                            d\g d]          d^                         Zej                            d_d`dag          db             Zej        ej                            dceeg          ej                            ddddg          ej                            d_d`dag          de                                                 Zdf Zdg Zdh Zej        di             Z ej        ej                            d_djdkg          dl                         Z!ej                            dmdndog          dp             Z"ej                            dqg dr          ej                            dsdtdug          dv                         Z#ej                            dw e$j%        dx           e$j%        dy          g          dz             Z&ej                            d{d|d}g          d~             Z'ej                            dw e$j%        d           e$j%        d          g          ej                            d\g d          d                         Z(d Z)ej                            dddg          d             Z*d Z+d Z,d Z-d Z.d Z/ej                            deefe0efe$j1        efeefg          d             Z2ej                            dd eddd)          gd eddd)          gg          d             Z3d Z4d Z5ej                            dddg          d             Z6d Z7ej                            dmddg          d             Z8d Z9ej                            dme:e;g          d             Z<ej                            d\g d          d             Z=ej                            dddg          ej                            dd`dg          d                         Z>ej                            ddg          ej                            dd`dg          d                         Z?ej                            ddgdgg dg          ej                            dd`dg          d                         Z@ej                            dddd`g          ej                            ddd`g          ej                            d!e0eAe$j1        eeBg          d                                     ZCd ZDej                            dddd`g          ej                            ddd`g          d                         ZEd ZFej                            dd`e$jG        fefeHz  z   efeHdz   z  fd` ed          fefeHz  z   e ed          fefeHz  z   fdefeHz  z   d ed          fz   efeHdDz   z   ed           ed          fz   ff          d             ZIej                            dddg          ej                            d eegdz  d`gdz  z   d           eegdz  d          f eegdz  d`gdz  z   d           eegdz  d          f ed`gdz             eegdz  d          f ed`gdz             eegdz  d          f edgdz             eegdz  d          f edgdz             eegdz  d          f eeJjK        gdz             eegdz  d          f eeJjK        gdz             eegdz  d          f ee$jG        gdz             eegdz  d          f ee$jG        gdz             eegdz  d          ff
          d                         ZLej                            dg d          d             ZMdÄ ZNej                            dddg          ej                            d eddDdD           eOddDdD           e$j%        dɦ          ddg          d˄                         ZPej                            dd eeeg          fd eddg          fg          dф             ZQd҄ ZRdӄ ZSdԄ ZTdՄ ZUdք ZVdׄ ZWej                            d ed٦           eddڬ)          f edd۬)           eddڬ)          fg          d݄             ZXej                            dg dߢ          d             ZYd ZZd Z[ej                            dddgd edd۬)          gd eddDdDd e\j]        d                    gg          d             Z^d`S )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   rF   r_   r0   )r4   rN   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_stringV  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&   rE   r   r   ISO8601non-ISO8601idsc                     t          ddd          }t          d|g|          }t          ddg          }t          j        ||           d S )Nr*  r   rg   
2020-01-01r   z
2020-01-02)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_string^  sW    
 $1<,V<<< ,!=>>
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rY   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   r>  ts1ts2r6   s	            r$   6test_to_datetime_mixed_datetime_and_string_with_formatzETestToDatetime.test_to_datetime_mixed_datetime_and_string_with_formath  sR    p k$q'""1gc3Z===
fh/////r&   c                 D    t          |                                           S r@  rA  rC  s    r$   rD  zTestToDatetime.<lambda>  rE  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 )Nr=  r<  r   r   r   z2000-01-01 02:00:00+0000r   r   ri   Fr  )r   r   r2   r   r   r   r3   )	r4   r   r>  rG  rH  rI  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)rQ  z2000-02-01 00:00:00+00:00r   znon-ISO8601, UTCc                 X    t          g d|d          }t          j        ||           d S )NrO  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&   rG  z2000-01-01 02:00:00-07:00z*all tz-aware, mixed timezones, without utcc                 D    t          |                                           S r@  rA  rC  s    r$   rD  zTestToDatetime.<lambda>  rE  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   rG  r>  rH  rI  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   rG   )r4   r   ra   r   r'  r7   s         r$   test_to_datetime_np_strz&TestToDatetime.test_to_datetime_np_str(  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_format<  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)re  z1999 Mondayz%G %A)re  z1999 Monz%G %a)re  1999 6z%G %w)re  rf  z%G %u)re  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)rc  1999 51 Sundayz%Y %V %A)rc  1999 51 Sunz%Y %V %a)rc  	1999 51 1z%Y %V %w)rc  rk  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)rl  ri  %V %A)rl  rj  z%V %a)rl  rk  z%V %w)rl  rk  z%V %u)rh  rd  z%G %j)rl  z	20 Mondayrn  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   rr  ri   r   )r  r  rl   rm   rn   r   )r4   r   r`  ra  rz   s        r$   test_error_iso_week_yearz'TestToDatetime.test_error_iso_week_yearH  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                 t    t          ddd|          }t          |          }t          |          }||u sJ d S )N
1965-04-03   2Wperiodsfreqr   )r   r   r   )r4   r   dtir5   r6   s        r$   test_to_datetime_dtarrz%TestToDatetime.test_to_datetime_dtarr  sE     rDDDC  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pyarrowrv  rw  rx  ry  ns)unitr   r  r   )rl   importorskipr   astyper   
ArrowDtype	timestampr   r   r2   rG   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                 v   t          j        d          5  t          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       _B)r2   set_timezoner   r   abs_valuer   )r4   r  pdnowpdnow2s       r$   test_to_datetime_nowz#TestToDatetime.test_to_datetime_now  s    _\** 	) 	)E""C&&E %))!,F u|cj011D8888v}sz122T9999<'''=((((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)s   BB..B25B2zPacific/AucklandzUS/Samoac                    t          j        |          5  t          j        d                              d                              t          j                  }t          d          }t          dg          d         }t          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  as_unitr  	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((G ((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E66E:=E:rN   r  r  c                 &    t          |g           d S r@  r   )r4   rN   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)r9  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  r:  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   rM   )r4   r%   r   s      r$   test_to_datetime_dt64sz%TestToDatetime.test_to_datetime_dt64sF  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 )Nr7  r   r  )r   r.   r  r   r2   r3   )r4   rN   rE   r6   r7   s        r$   test_to_datetime_dt64s_and_strz-TestToDatetime.test_to_datetime_dt64s_and_strL  sP     c2=#>#>?OOO ,!=>>
fh/////r&   z
1000-01-01z
5000-01-02)rp  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%   r`  )r   rF   r   r  asm8)r4   r%   r   rz   tss        r$   'test_to_datetime_dt64s_out_of_ns_boundsz6TestToDatetime.test_to_datetime_dt64s_out_of_ns_boundsY  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D"Out of bounds nanosecond timestampri   rp  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_boundsh  sE   }RXbh//3S992].c::: 	 	dOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	].c::: 	; 	;WE::::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 4>>>#EEEEEEs$   A00A47A4B55B9<B9r  r`  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 rU   r   r  rW   s     r$   rZ   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 rU   r  rW   s     r$   rZ   zBTestToDatetime.test_to_datetime_array_of_dt64s.<locals>.<listcomp>  r  r&   r   
9999-01-01rp  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_dt64ss  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                     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   t	          ||d	
          }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   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   r   r2   r3   r   )r4   r%   r5   r   r6   r7   s         r$   test_to_datetime_tz_mixedz(TestToDatetime.test_to_datetime_tz_mixed  se    +===+===

6 	 ]:S111 	* 	*5))))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* Sh???566566 
 
 
 	fh///Sh??? (%08T
 
 
 	fh/////s    AA"%A"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+0500rS   c                 ,    g | ]}t          |          S rU   r	   rW   s     r$   rZ   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%   rQ  2000-06-01 07:00:00+00:00r:  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   r   )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   rG   )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   rG   )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_string  sn    (+rdQhTt59999[U;;;<q@AA
vx00000r&   zdate, dtype)r  r  )r  r:  c                     t          t          dd          g          }t          t          |g|          d|          }t          j        ||           d S )Nr  r   r   r+   Tr  )r   r   r   r2   rG   )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$  s^     9%:uEEEFGG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%   rQ  r  r:  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_psycopg20  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%   rN   r   s       r$   test_datetime_boolz!TestToDatetime.test_datetime_boolV  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   rN   r   s      r$   test_datetime_invalid_datatypez-TestToDatetime.test_datetime_invalid_datatyper  s     /]9C000 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   ;??)r   rp  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   rV  )r4   rz   s     r$   test_invalid_format_raisesz)TestToDatetime.test_invalid_format_raisesy  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   rp  )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   rp  z!^Out of bounds .*, at position 0$)r   r   rl   rm   rn   r   r%  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rI   )r  bz99:00:00c           	      6   |t          |          dk    rt          }nd }t          j        |d          5  t	          |d|          }d d d            n# 1 swxY w Y   t          j        |t          |                     t          j        |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          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 formatri   rx   r   r   r
  r"  r!  r  r#  r$  rp  )lenUserWarningr2   r   r   r3   r   r   r   r  r  rl   rm   rn   )r4   rI   rE   warnr'  r   s         r$   test_datetime_invalid_indexz*TestToDatetime.test_datetime_invalid_index  s    >c&kkAooDDD'4LMMM 	F 	FfXfEEEC	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F
c5==111'4LMMM 	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+D8PQQQ 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B77B;>B; FE6*F6E:	:F=E:	>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   r>  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 r1  r   )r4   r  rE   r   r4  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 )Nr2  Tr   rM   )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-26r@  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%   )inputr7      r0   (   r  r   x   r  c                 R    t          ||          }t          j        ||           d S r  r   )r4   r%   rD  r7   r6   s        r$   *test_to_datetime_converts_null_like_to_natz9TestToDatetime.test_to_datetime_converts_null_like_to_nat  s/    0 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)rJ  z%U %A)rK  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   rV  )r4   r   rE   r   s       r$   'test_week_without_day_and_calendar_yearz6TestToDatetime.test_week_without_day_and_calendar_year.  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   rQ  r   r   )r   r   r   r   r2   r3   )r4   
string_argrE   rU  rS  r6   r7   s          r$   test_to_datetime_coerce_oobz*TestToDatetime.test_to_datetime_coerce_oobS  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          5  t          ||          }d d d            n# 1 swxY w Y   t          j        ||           d S )NrY  rZ  r+  ri   r&  )r2   r   r-  r   r3   )r4   rz   r7   rS  r6   s        r$   #test_to_datetime_malformed_no_raisez2TestToDatetime.test_to_datetime_malformed_no_raiseh  s     %n5
';STTT 	< 	< 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 )NrY  rZ  zParsed string "200622-12-31" gives an invalid tzoffset, which must be between -timedelta\(hours=24\) and timedelta\(hours=24\), at position 0ri   r+  rp  r&  rl   rm   rn   r2   r   r-  r   )r4   rS  r   s      r$    test_to_datetime_malformed_raisez/TestToDatetime.test_to_datetime_malformed_raisew  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 )Nra  2015-11-18 16:30:00+06:30r   ri   r^     r-  r  r   iXM  r      ih[  r+   )r   r2   r   r   r   r.   r/   r   r   r0   r   r3   rR  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 )Nra  re  Tr  r^  rf  r-  r   r   r   )r   r   r   r   r2   r3   )r4   rS  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 r@  rU   )rX   r  ra   valss     r$   	<genexpr>zPTestToDatetime.test_mixed_offsets_with_native_datetime_raises.<locals>.<genexpr>  s0      ??3q6T!W$??????r&   r   ri   r   r+   g?zTz-aware datetime.datetime)r   r   allranger,  r2   r   r   r   rB  r0   rG   rZ  r  rl   rm   rn   )r4   r  r  r   mixedr7   ra   rm  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   rQ  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 )Nr  ri   r\   r   rl   rm   r   r   )r4   rz  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 	1rN  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} t          ddd|          t          ddd|          t          ddd|          g}t          |          }|j        |k    sJ d S )Nr   )	fixed_offr   r   r   rg   r   )-pandas.tests.indexes.datetimes.test_timezonesr  r   r   r   )r4   r  r   r6   s       r$   test_to_datetime_fixed_offsetz,TestToDatetime.test_to_datetime_fixed_offset  s    KKKKKK 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 	) 	)%((((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)rN  )_r  r  r  rl   r  filterwarningsr(  r1  r  r8  r!   r   r   rJ  rM  r   r   rP  rS  rW  r[  r   rb  rs  r}  r  skip_if_windowsr   r  r  r  r  r  r  r  r  r.   r  r  r  r  r  r  r  r  r  r  r  listr/   r  r   r  r  r	  r  r  r  boolr   r  r  r&  r(  r/  tupler   r5  r9  r;  r=  rk   r   rC  r   r   rI  rM  rT  r   rX  r\  r_  rc  rh  rj  rt  rw  ry  r  r  r  r   r   r  rU   r&   r$   r#  r#  >  s;       [ ?@@? ? A@?,- - - [: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< [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[ urzTFRK/x@@@urz)9:::
 urzTFRK/x@@@us{*:;;; VTFRK  &&#;K"L"L"LMVTFRK  &&#;K"L"L"LMVRD2Iurz9I J J JKVRD2Iurz9I J J JKVRUGbL!!663%"*<L#M#M#MNVRUGbL!!663%"*<L#M#M#MNVRVHrM""FFC52:=M$N$N$NOVRVHrM""FFC52:=M$N$N$NO!	
 *1 1+  54,1
 [	
 	
 	

 
- -
 
-0 0 0& [	')CD  [HT1a  Dq!BM,''	
	 	0 0	 		 0 [uuc3Z(()uunn=>>?	
 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            	       6   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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 )/TestToDatetimeUnitr  YMitem   c                 R   t          ||          }t          |g          }t          |g||          }t          j        ||           t          t          j        |gt                    ||          }t          j        ||           t          |t                    rM|j
                            t          j                            t          |          j         d                     t          t          j        |g          ||          }t          j        ||           d S )Nr  r  r%   r+   z in np.array should workr   )r   r   r   r2   r3   r.   r/   r0   rF   rd   node
add_markerrl   r  r  r  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$''' "&&dV$e<<<
fh///RXtfF;;;$eTTT
fh/// dE"" 	L##!!"4jj1KKK "    
 RXtf--DFFF
fh/////r&   c                    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	          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         ?rp  r  rz   z1.5rx   r   r   r+         ?r  r   )
rl   rm   rn   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_float2  sS   
 @LLLL]:S111 	: 	:D9999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:]: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,,,,,sk   AAA*B=B&B=&B*	*B=-B*	.B==CC#DD
D(FFF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%   rV  r  s      r$   	test_unitzTestToDatetimeUnit.test_unitQ  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           
      8   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          }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   z8cannot convert input 11111111111111111 with the unit 'D'ri   rp  )r   r   r.   rk   r   r   r   r0   r2   r3   r   rl   rm   r   r4   r%   rI   r6   r7   r   s         r$   test_unit_array_mixed_nansz-TestToDatetimeUnit.test_unit_array_mixed_nansX  sx   #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   .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          }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   r`  rz   r  r%   r+   r   )r   r   r   r   r   z@cannot convert input 1420043460000000000000000 with the unit 's'ri   rp  )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_intt  sC   +T3FVH3eLLL3S#sCHPVWWW
fh///VH3eLLL !D!D!DEE
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**C.1C.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  rp  r`  r  rV  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errorro  c                     t          d          }t          dd||          }||k    sJ t          |t                     sJ d S )Nz1970-05-09 14:25:11iǊ r`  r  )r   r   rF   )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   rp  r   r,   float64r  c                     t          ddg          }t          j        ddg                              |          }t	          |||          }t          j        ||           d S )N2015-06-19 05:33:202015-05-27 22:33:20@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  sg    
 !"79N!OPP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          |          }t          j        |d          5  t          |d|          }d d d            n# 1 swxY w Y   t          j        ||           d S )Nr+  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    $ !%%'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 rU   rV   rW   s     r$   rZ   z6TestToDatetimeUnit.test_unit_mixed.<locals>.<listcomp>  s    4441)A,,444r&   r   r+   r   r  rp  )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                 X    t          dd|          }t          d          }||k    sJ d S )Ng aAr`  r  z2015-06-19 19:55:31.877000192rM   r   s       r$   test_unit_roundingz%TestToDatetimeUnit.test_unit_rounding  s>     /cGGG<==!!!!!!r&   c                     t          dgdz  d          }t          |dd|          }t          j        ||           d S )Ng   Brg   r  r  rx   r`  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   r`  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!8UCCC
fh/////r&   c                    dt          fdt          d          D                                           |          }t          |d          }t          d t          d          D                       }t	          j        ||           d S )NQc                     g | ]}|z   S rU   rU   rX   tepochs     r$   rZ   z<TestToDatetimeUnit.test_to_datetime_unit.<locals>.<listcomp>      333Aeai333r&   rE  r`  r  c                 N    g | ]"}t          d           t          |          z   #S z2013-06-09 02:42:28)secondsr   r   rX   r  s     r$   rZ   z<TestToDatetimeUnit.test_to_datetime_unit.<locals>.<listcomp>  1    XXXY,--	!0D0D0DDXXXr&   )r   rr  r  r   r2   rG   )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+++XXeTViiXXX
 
 	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             }t	          j        ||           d S )Nr  c                     g | ]}|z   S rU   rU   r  s     r$   rZ   zGTestToDatetimeUnit.test_to_datetime_unit_with_nulls.<locals>.<listcomp>  r  r&   rE  r`  r  c                 N    g | ]"}t          d           t          |          z   #S r  r  r  s     r$   rZ   zGTestToDatetimeUnit.test_to_datetime_unit_with_nulls.<locals>.<listcomp>  r  r&   )r   rr  r   r   r2   rG   )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	          }t          j
        ||           d S )
Nr  c                     g | ]}|z   S rU   rU   r  s     r$   rZ   zOTestToDatetimeUnit.test_to_datetime_unit_fractional_seconds.<locals>.<listcomp>  s    ???Aeai???r&   r   rg   g      ?r`  r  c                 N    g | ]"}t          d           t          |          z   #S r  r  r  s     r$   rZ   zOTestToDatetimeUnit.test_to_datetime_unit_fractional_seconds.<locals>.<listcomp>  sA        /009Q3G3G3GG  r&   ms)r   r.   aranger   r  rd   r   r   roundr2   rG   )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             }t          j        ||           d S )	Nr   rg   r   r  r  r  
1970-01-03r   )r   r   r.   rk   r   r   r2   r3   r   s      r$   test_to_datetime_unit_na_valuesz2TestToDatetimeUnit.test_to_datetime_unit_na_values  sn    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  rV  )r4   r  r   s      r$   test_to_datetime_unit_invalidz0TestToDatetimeUnit.test_to_datetime_unit_invalid  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             }t          dd|gdd          }t          j        ||           d S )	Nr  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_coerce  sk     !|$$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 ]H}t          |d|	          }t          j        |                    t          j                  |d
           It          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+   ro  r  r  g|=)rtolri   rp  )r   rd   r  r.   r  r   r2   assert_almost_equalrl   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_bounds  s   2),%~'=>e
 
 
 #\199"(CC7 	S 	SJ!.s:NNNG"7>>"(#;#;XERRRRRq-%"78FFFq=.5"89GGG].c::: 	@ 	@3w????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@].c::: 	@ 	@3w????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@s$   )DDD.EEE)!r  r  r  rl   r  r  rd   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  rU   r&   r$   r  r    ss       [Vc3Z00[Vc55::%6770 0 87 100* [Vc3Z00- - 10-<E E EG G G8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 )Nr^    rg   r   r   rS   r     :   ;   r   rf  r   	r  r  r  r  r  secondr  usr  )r   r4   s    r$   dfzTestToDatetimeDataFrame.df1  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   rG   to_dictr4   r  r%   r6   r7   s        r$   test_dataframez&TestToDatetimeDataFrame.test_dataframeA  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   rG   )r4   r  r%   df2r6   	expected2s         r$   &test_dataframe_dict_with_constructablez>TestToDatetimeDataFrame.test_dataframe_dict_with_constructableN  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          }t          j        ||           d S )Ncolumnsr   z20150204 06:58:10z20160305 07:59:11)r   r  keysrenamer   r   r2   rG   )r4   r  r%   r  r6   r7   s         r$   *test_dataframe_field_aliases_column_subsetzBTestToDatetimeDataFrame.test_dataframe_field_aliases_column_subsetX  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   rG   )r4   r  r%   dr6   r7   s         r$   test_dataframe_field_aliasesz4TestToDatetimeDataFrame.test_dataframe_field_aliasesu  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   rG   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 )Nr^  r  rg   rE  r   rS   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   rG   )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   rV  )r4   r  r%   r!  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 keysr^  r  rg   rE  r   rS   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 )Nr^  r  rg   r   r   rS   r  int16r   r  20160305 00:00:00)r   r   r  r   r   r2   rG   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 )Nr^  r  rg   r   r   rS   r  r  int8r  r   r  r(  )r   r  r   r   r   r2   rG   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 )Nr^  r  rg   r   r   rS   r  Tr  z
2015-02-04z
2016-03-05r  r+   r   )	r   r   r   r.   r/   r   tz_localizer2   rG   )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  r   r#  r%  r*  r-  r/  r2  rU   r&   r$   r  r  0  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/g          d<             Z0d=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   rM   )r4   r%   rN   exp_strr6   r   s         r$   test_to_datetime_iso8601z+TestToDatetimeMisc.test_to_datetime_iso8601	  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   rV  )r4   rD  rE   r   s       r$   test_to_datetime_iso8601_failsz1TestToDatetimeMisc.test_to_datetime_iso8601_fails	  s    " ]0 0 00 0 0
 
 
 	; 	; fE::::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	;s   AA
A)r?  r>  )r@  r   )rA  r   )rB  r   rC  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   rD  rE   r   s       r$   $test_to_datetime_iso8601_exact_failsz7TestToDatetimeMisc.test_to_datetime_iso8601_exact_fails*	  s     hh7$37 7 7&"& & &
 
 ]
 
 
 	. 	. f----		. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s   A$$A(+A()rH  )z2012-01-01 00r   )z2012-01-01 00:00r   )r8  r   c                 \    t          ddd          }t          ||d          }||k    sJ d S )Nr   r   Fr   r   r   r4   rD  rE   r7   r6   s        r$   "test_to_datetime_iso8601_non_exactz5TestToDatetimeMisc.test_to_datetime_iso8601_non_exactE	  s@     T1a((U6???!!!!!!r&   ))2020-01z%Y/%m)r7  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 )NrE  z\" doesn\'t match format \"rF  ri   r   rV  )r4   rD  rE   s      r$   "test_to_datetime_iso8601_separatorz5TestToDatetimeMisc.test_to_datetime_iso8601_separatorT	  s     ]0 0 00 0 0
 
 
 	. 	. f----	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s   AA	A))rO  r>  )r7  r   )rP  r   )rQ  %Y-%m-%dT%H)rR  r   )rS  %Y-%m-%dT%H:%M)rT  r   )rU  %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.000000r[  )z2020-01-01T00:00:00.000000000r[  c                 Z    t          ddd          }t          ||          }||k    sJ d S Nr*  r   r   rL  rM  s        r$   test_to_datetime_iso8601_validz1TestToDatetimeMisc.test_to_datetime_iso8601_validl	  >    $ T1a((U6222!!!!!!r&   ))z2020-1r>  )z2020-1-1r   )z
2020-1-1 0r   )z
2020-1-1T0rX  )z2020-1-1 0:0r   )z2020-1-1T0:0rY  )z2020-1-1 0:0:0r   )z2020-1-1T0:0:0rZ  )z2020-1-1T0:0:0.000r[  )z2020-1-1T0:0:0.000000r[  )z2020-1-1T0:0:0.000000000r[  c                 Z    t          ddd          }t          ||          }||k    sJ d S r]  rL  rM  s        r$   #test_to_datetime_iso8601_non_paddedz6TestToDatetimeMisc.test_to_datetime_iso8601_non_padded	  r_  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:00Zrb  c                 r    t          dddt          j                  }t          ||          }||k    sJ d S )Nr*  r   r   r   )r   r   r   r   rM  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 raiser  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%   r^  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   rz  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   rp  r  r   i  r   r-  r  rx   )
r   r  rl   rm   rn   r   r   r   r2   rG   )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   rG   )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   r1  r   s      r$   test_to_datetime_timezone_namez1TestToDatetimeMisc.test_to_datetime_timezone_name	  sL    5>STTTT1a((44U;;!!!!!!r&   rz   ro  c                     t          g dg d          }t          |d|          } |j        fd          }t          j        ||           d S )N)rx  ry  r  rz  r{  r}  ry   c                 *    t          | dd          S )Nr}  r   ry   r   )rY   r%   s    r$   rD  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   rq  r  s      r$   test_to_datetime_empty_str_listz2TestToDatetimeMisc.test_to_datetime_empty_str_list	  s<    b"XU333F||!!!!!!!r&   c                 V    t          d          }t          d|          }||k    sJ d S )Nr   r   rL  r   s       r$   test_to_datetime_zeroz(TestToDatetimeMisc.test_to_datetime_zero	  s6    1q...!!!!!!r&   c                 h    t          dg|          d         }t          d|          }||k    sJ d S )Nr=  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)r=  20120101z20120101 12:01:01c                 2    g | ]}t          |           S )r   r   )rX   rz  r%   s     r$   rZ   zITestToDatetimeMisc.test_to_datetime_strings_variation.<locals>.<listcomp>
  s&    IIIKe444IIIr&   c                 ,    g | ]}t          |          S rU   rV   )rX   date_strs     r$   rZ   zITestToDatetimeMisc.test_to_datetime_strings_variation.<locals>.<listcomp>
  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   r=  c                 8    t          ddd          }||k    sJ d S )Nr   r   rV   r   s      r$   'test_to_datetime_strings_vs_constructorz:TestToDatetimeMisc.test_to_datetime_strings_vs_constructor
  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   rp  )	r   r   r.   r/   r2   r   rl   rm   rn   )r4   r%   r6   r7   r   s        r$   $test_to_datetime_unprocessable_inputz7TestToDatetimeMisc.test_to_datetime_unprocessable_input
  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_input
  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   rE  ro  )r   r   rI   r  asi8r2   r3   )r4   rngintsr6   s       r$   !test_to_datetime_list_of_integersz4TestToDatetimeMisc.test_to_datetime_list_of_integers&
  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Br3  )startr{  rz  )rl   rm   r   r   r4   r   s     r$   r(  z,TestToDatetimeMisc.test_to_datetime_overflow0
  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   rp  r  )r.   r/   r0   rl   rm   rn   r   )r4   r%   invalids      r$   test_string_invalid_operationz0TestToDatetimeMisc.test_string_invalid_operation7
  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   rF   r   assert_numpy_array_equalrI   )r4   r%   stringsr7   r  r   r6   result2s           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          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   rp  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_malformedQ
  s   HlBF36BBB	 0]:S111 	@ 	@	'????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ YxuEEE##
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  r)  cr  erA   rC   z1/5/2000r  r|  r  r   rS   r   r+   r{  F)check_names)r   r.   rk   r   r  rr  rZ  r   r   r2   rG   r  )
r4   r%   idxr  dseriesr6   dresultr7   r  rY   s
             r$   'test_string_na_nat_conversion_with_namez:TestToDatetimeMisc.test_string_na_nat_conversion_with_namea
  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mr`  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  r`  )r.   r,   r   rI   r  r   r2   r3   )r4   r%   r  r,   baserI   	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/2014r\  rg   r   rf  r   Trl  rk  )	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   ro  r  r   Tr  )r   r  r1  r   r2   r   )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)1r  r  r  r7  rl   r  r  r<  rG  rJ  rN  rW  r^  ra  rd  ri  r  rm  rp  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  rU   r&   r$   r5  r5    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}m&DEE	* 	* FE	* 	* 	*r&   r5  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_nans
  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  rU   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.%fr[  c                     t          t          ddd                    }|                    fd          }t          ||          }t          ||          }t	          j        ||           d S )Nr:   2   Hrz  r{  c                 .    |                                S r@  )strftime)rY   r  s    r$   rD  zdTestToDatetimeInferFormat.test_to_datetime_infer_datetime_format_consistent_format.<locals>.<lambda>  s    ajj.E.E r&   rD   r   )r   r   r^   r   r2   rG   )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_format  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   rG   )r4   r%   r   ra   r6   r7   s         r$   "test_to_datetime_consistent_formatz<TestToDatetimeInferFormat.test_to_datetime_consistent_format  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   rG   r{   s        r$   !test_to_datetime_series_with_nansz;TestToDatetimeInferFormat.test_to_datetime_series_with_nans"  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_nans/  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   r1  r2   rG   )r4   tz_namer  ra   r6   r   r7   s          r$   "test_infer_datetime_format_tz_namez<TestToDatetimeInferFormat.test_infer_datetime_format_tz_nameC  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   rG   )r4   r  zero_tzra   r6   r   r7   s          r$   "test_infer_datetime_format_zero_tzz<TestToDatetimeInferFormat.test_infer_datetime_format_zero_tzO  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          j        t	          |||          |           d S )N)2014-1-1z2014-2-2z2015-3-3z
2014-01-01z
2014-02-02z
2015-03-03rD   )r   r   r2   rG   r   )r4   r%   rE   ra   r7   s        r$   %test_to_datetime_iso8601_noleading_0sz?TestToDatetimeInferFormat.test_to_datetime_iso8601_noleading_0s`  sw     999::,'','',''
 
 	{3vUKKKXVVVVVr&   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_warningm  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  rU   r&   r$   r  r  
  sR       [SSS < < <* * *1 1 11 1 11 1 1( [555 1 1	 1 [	
 	
 	
 1 1 1 [Xj'9::
W 
W ;:
W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%   rN   rE   s       r$   test_day_not_in_month_coercez,TestDaysInMonth.test_day_not_in_month_coercey  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  rp  r  rV  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   rp  r  rV  )r4   r%   rN   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  r  r!  r  r#  r%  rU   r&   r$   r  r  v  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-11rf  z2005 11z11-2005z11 2005200511r*  rS   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 2014r\  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+   )rA  r%   Sr   )r{  rz  rA  )r   parse_datetime_string_with_resor   r.   r/   r0   r   r   r   r   r2   r3   r   )r4   r  r7   r%   rA  r  _r  result3result4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_cache  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   rC  r   r   r   r   )r4   r  rD  r  rE  rF  s         r$   test_parsers_natz,TestDatetimeParsingWrappers.test_parsers_nat   s|    <UCC
e$$E""((+#~~~~#~~~~#~~~~#~~~~~~r&   z'date_str, dayfirst, yearfirst, expectedz10-11-12Fr   Ti  z20/12/21i  rE     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)rl  rA  )rl  rA  r%   r   )r
   r   rC  r   r   r   )r4   r%   r  rl  rA  r7   dateutil_resultr  rD  r  rE  rF  s               r$   test_parsers_dayfirst_yearfirstz;TestDatetimeParsingWrappers.test_parsers_dayfirst_yearfirst+  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   rC  r   r   r   )
r4   r  exp_defexp_nowr  rD  r  rE  rF  rJ  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   r1  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   rL  rP  rR  rV  rZ  r   r   r`  rU   r&   r$   r'  r'    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&   r'  )r  r`  r  r  r  c                     | j         S )zIDay and some time units.

    * D
    * s
    * ms
    * us
    * ns
    r    r"   s    r$   unitsrb    s     =r&   c                       t          d          S )zTimestamp at 1960-01-01.
1960-01-01rV   rU   r&   r$   
epoch_1960re    s     \"""r&   c                  :    t          t          d                    S )NrS   )r  rr  rU   r&   r$   units_from_epochsrg    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
    >   ri  r  r  rh  r  rh  r  )r!   rB  to_datetime64r_   )re  r#   s     r$   epochsrl    su     =QQQQQ}##	,	&	&'')))	,	&	&''))):r&   c                  R    t          dd                                          j        S )Nr  r   ro  )r   to_julian_daterI   rU   r&   r$   julian_datesro    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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   r`  r  originz1970-01-01 00:00:02i ʚ;z2001-09-09 01:46:41rM   )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  julianrs  r   r  )r   r   r   rn  r2   rG   )r4   ro  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          }t          j        ||           d S )N)r   r   rg   r  unixrs  z
1970-01-01r  r  r  r   s      r$   	test_unixzTestOrigin.test_unix  sn    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|% rw  r  rt  r  z&1 is Out of Bounds for origin='julian'ri   r   )r   rn  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 	6rt  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   rw  rs  rV  )r4   rb  ro  r   s       r$   test_invalid_unitzTestOrigin.test_invalid_unit  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-01rd  r}  rV  )r4   r  r   s      r$   test_invalid_originzTestOrigin.test_invalid_origin	  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  c                     t          fd|D                       }t          t          ||                    }t          j        ||           d S )Nc                 B    g | ]}t          j        |           z   S )r  )r   	Timedelta)rX   rY   re  rb  s     r$   rZ   z)TestOrigin.test_epoch.<locals>.<listcomp>  s-    QQQ!R\!%(((:5QQQr&   rs  r   )r4   rb  rl  re  rg  r7   r6   s    ` `   r$   
test_epochzTestOrigin.test_epoch  sf    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-1990r   c                     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   rs  )r  rl   rm   r   )r4   rt  excrb  rg  r   s         r$   test_invalid_originszTestOrigin.test_invalid_origins  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   rs  )rl   rm   rn   r   r   r   r  r   s    r$   test_invalid_origins_tzinfoz&TestOrigin.test_invalid_origins_tzinfo,  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  	yesterdayrV  r  s     r$   test_incorrect_value_exceptionz)TestOrigin.test_incorrect_value_exception1  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 	0rN  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_arg9  s     Y].c::: 	> 	>-f====	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>rN  zarg, origin, expected_str)( rz  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  rs  r  r  r  r  r  rM   )r4   rN   rt  expected_strr6   r7   s         r$   test_processing_orderz TestOrigin.test_processing_orderG  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          }t          j        ||           d S )Nz2019-01-01T00:00:00.000r  )r  r  r   )r4   r  r  r   rN   r6   r7   s          r$   test_arg_tz_ns_unitzTestOrigin.test_arg_tz_ns_unit_  sL     (&0cU3777u%%
fh/////r&   )r  r  r  ru  rx  r{  r~  r  rl   r  r  r  r  rn   r   r   r  r  r  r-  r  r  r  rU   r&   r$   rq  rq    s&         1 1 11 1 16 6 6G G G [VdC[11F F 21F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&   rq  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   rS   r  r  r:  r9  r   F)
r   r   r   r   r   rS   r  r  r:  r9  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_cacheq  sA     xS]]QTUUU     r&   z%unique_share,check_count, err_message)g      ?rf  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 )NrS   r   ri   )rl   rm   AssertionErrorr  r  )r4   r  r  err_messagerN   s        r$   test_should_cache_errorsz(TestShouldCache.test_should_cache_errors~  s     cBh]>=== 	? 	?sL+>>>	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?s   AA
A
r  r7  r8  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  rU   r&   r$   r  r  p  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  r  r   r.   r  r2   rG   )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   )rF   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   ro  zargs, format)z
03/24/2016z
03/25/2016r  r=   )
2016-03-24
2016-03-25r  r   r3  r2  r4  c                     t          |          }t          |||           }t          ddt          gd          }t          j        ||           d S )Nr   r  r  r  r+   )r   r   r   r2   rG   )rz   rG  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  r`  r   r  r  r   r  r+   rp  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   rZ  r2   rG   )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_lengthrF  r   rS   c                 l   t          t          j        d          gt          j        d          g| z  z             }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   T)rz   r  rx   r  ri   rp  )r   r   fromisoformatr   r   r   r2   rG   rl   rm   r   )r  r`  r  	expected1r  r
  s         r$   2test_to_datetime_cache_coerce_50_lines_outofboundsr    s    			 ;	<	<="#>??@=P	R	 	A !H$777G	)7889MIJ I 7I...!H$777G		 ;	<	<="#>??@=P	R I
 7I...	*2V	W	W	W 1 1Ag400001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1s   	D))D-0D-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
nanosecondrM   )r  timestamp_formatr6   r7   s       r$   %test_to_datetime_format_f_parse_nanosr    se    /I-+;<<<F	 	 	H Xr&   c                  x    t          ddgd          } t          ddg          }t          j        | |           d S )Nr7  z2020-01-01 05:00:00r2  r   rT  r  r  s     r$   test_to_datetime_mixed_iso8601r    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 2000rs  r   z
2000-01-11z
2000-01-12r  r  s     r$   test_to_datetime_mixed_otherr    sE    ,(9:7KKKFlL9::H&(+++++r&   r   rE   rs  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   r7  )r   rE   rV  )r   rE   r   s      r$   #test_to_datetime_mixed_or_iso_exactr  $  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   r7  
01-01-2000r2  r   rV  rU   r&   r$   4test_to_datetime_mixed_not_necessarily_iso8601_raiser  ,  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   rT  rx   r7  r  c                 X    t          ddgd|           }t          j        ||           d S )Nr7  r  r2  r   r   )rz   r7   r6   s      r$   5test_to_datetime_mixed_not_necessarily_iso8601_coercer  4  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  A  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   rG   )any_numeric_ea_dtypera   r6   r7   s       r$   test_from_numeric_arrow_dtyper  Q  s|    
	"""
!Q"6"<"<">">III
J
J
JCFq!f$4555H68,,,,,r&   c                      t          ddgd          } t          t          d          dgt                    }t	          j        | |           d S )N2020-01-01 00:00+00:00r  rs  r   r   r+   )r   r   r   r0   r2   r3   r  s     r$   6test_to_datetime_with_empty_str_utc_false_format_mixedr  Z  sS    2B7HHHFi 8995APPPH&(+++++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  rs  r   r  )r   s    r$   Btest_to_datetime_with_empty_str_utc_false_offsets_and_format_mixedr  a  s    
GC		#M	=	=	= 
 
DDDW	
 	
 	
 	

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
r  )]__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  r3  r%   r(   r#  r  r  r5  r  r  r  r'  rb  re  rg  rl  ro  rq  r  r  r  r  r/   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rU   r&   r$   <module>r     s                              ! ! ! ! ! ! # # # # # #                           * ) ) ) ) ) ) ) ) < < < < < <    
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
       , , , , , , 0 0 0 0 0 0 8 8 8 8 8 8  e}%%%  &%v0 v0 v0 v0 v0 v0 v0 v0rY) Y) Y) Y) Y) Y) Y) Y)x&S@ S@ S@ S@ S@ S@ S@ S@lF1 F1 F1 F1 F1 F1 F1 F1Rc* c* c* c* c* c* c* c*L1 1 1 1 1 1 1 1<vD vD vD vD vD vD vD vDr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P0 P0 P0 P0 P0 P0 P0 P0f%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 1 1	 16  $, , ,, , , 4-00Iw#788@ @ 98 10@D D D 	=="7!=>>?	55,5667 , , ,: : : - - -, , ,
 
 
 
 
r&   