
    {hh(@                       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 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/Z0 ddl1m2Z2 ddl3m4Z5 ddl6m7Z7 dZ8erdZ9dZ:ndZ9dZ:ej;        <                    d          Z= ej>        ddg          d             Z? G d d          Z@ G d d          ZA G d d           ZB G d! d"          ZC G d# d$          ZD G d% d&          ZE G d' d(          ZF G d) d*          ZG G d+ d,          ZH ej>        g d-          d.             ZIej>        d/             ZJej>        d0             ZK ej>        g d1          d2             ZLej>        d3             ZM G d4 d5          ZN G d6 d7          ZOd8 ZPej;        Q                    d9ejR        eSg          d:             ZTej;        Q                    d;g d<          ej;        Q                    d=g d>d?fg d@dAfgdBdCgD          dE                         ZUdF ZVej;        Q                    dGddg          dH             ZWej;        Q                    dIdJe7e7dKz   e7dLz   g          dM             ZXdN ZYdO ZZdP Z[ej;        Q                    dQddg          ej;        Q                    dRdCdSg          dT                         Z\dU Z]ej;        Q                    dVdW e&dXe(g          fdY e'dZd[gd\]          fg          d^             Z^d_ Z_d` Z`da Zadb Zbdc Zcdd ZddeZe e*ee          Zfej;        <                    df          ej;        Q                    dgee e*ee          gdh D          ej;        Q                    dieeddj         efg                    d          ef                                efjh        efji         ejefji                  gdk D          ej;        Q                    dlddg          dm                                                 ZkdS )nz test to_datetime     N)deque)datedatetime	timedeltatimezone)Decimalparse)tzoffset)tslib)iNaTparsing)PY314)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.z, not 99zXday \d{1,2} must be in range 1\.\.\d{1,2} for month \d{1,2} in year \d{4}, at position 0 z,day is out of range for month, at position 0z2ignore:errors='ignore' is deprecated:FutureWarningTF)paramsc                     | j         S )z/
    cache keyword to pass to to_datetime.
    paramrequests    Z/var/www/histauto/venv/lib/python3.11/site-packages/pandas/tests/tools/test_to_datetime.pycacher'   M   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_readonlyV   se     hr((( 	&LLuL%%%S!!r??
fh/////r(   zformat, expected%d/%m/%Y200001012000020120000301%m/%d/%Y2000010220000103c                      |g d          }t          |||          } ||          }t          j        ||           d S )N)1/1/20001/2/20001/3/2000formatr'   )r   r4   assert_equal)r6   r'   index_or_seriesrG   r9   valuesr8   s          r&   test_to_datetime_formatz1TestTimeConversionFormats.test_to_datetime_format`   sU     !!E!E!EFFVF%@@@"?8,,
)))))r(   zarg, expected, format)rC   r<   r;   )rC   r<   r?   )rD   r=   r;   )rD   r@   r?   )rE   r>   r;   )rE   rA   r?   c                 X    t          |||          }t          |          }||k    sJ d S NrF   r   r   )r6   r'   argr9   rG   r8   s         r&   test_to_datetime_format_scalarz8TestTimeConversionFormats.test_to_datetime_format_scalars   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>       @@@A9Q<<@@@r(   %Y%m%drF   r   applystrr   r4   assert_series_equalr6   r'   serr9   r8   s        r&    test_to_datetime_format_YYYYMMDDz:TestTimeConversionFormats.test_to_datetime_format_YYYYMMDD   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 )NrR   rS   rT   floatr-   1980122219810105   r]   rF   natzOunconverted data remains when parsing with format "%Y%m%d": ".0", at position 0match)r   r   r0   nanr   r4   ra   r_   r`   pytestraises
ValueError)r6   r'   rc   r9   r8   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 rT   rf   r-   1980120119810101ri   %Y%mrF   )r   r   r0   rm   r   r4   ra   rb   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rG   errorsr'   r-   )r   r   r2   r4   ra   r6   r'   rc   r8   r9   s        r&   'test_to_datetime_format_YYYYMMDD_ignorezATestTimeConversionFormats.test_to_datetime_format_YYYYMMDD_ignore   si     33344S(%PPP***
 
 
 	vx00000r(   c                     t          ddt          j        gdd|          }t          ddt          j        gt                    }t          j        ||           d S )N1501010120150101r]   rz   r{   r-   )r   r0   rm   r   r2   r4   r5   r6   r'   r8   r9   s       r&   8test_to_datetime_format_YYYYMMDD_ignore_with_outofboundszRTestTimeConversionFormats.test_to_datetime_format_YYYYMMDD_ignore_with_outofbounds   sa    RV,	
 
 
 *j"&9HHH
fh/////r(   c                     t          g d          }t          |dd|          }t          g dd          }t          j        ||           d S )Nry   r]   coercer{   )2012123120141231r   M8[ns]r-   r   r   r4   ra   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)rg   20010112Nrg   r   )rg   r   r   )rR   T1NrR   r   )rR   r   r   c                     t          t          d          t          d          t          g          }t          t          |d                    }t	          j        ||           d S )Nrg   r   r]   rG   )r   r   r   r   r4   ra   r6   r   r9   r8   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   rG   r|   )r   r4   ra   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   r4   r5   )r6   datarG   r9   r8   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   r4   r5   r6   r8   r9   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 rV   rW   rX   s     r&   r[   zMTestTimeConversionFormats.test_to_datetime_format_integer.<locals>.<listcomp>%  r\   r(   z%YrF   )iA i i c                 X    g | ]'}t          |d d         dz   |dd          z             (S )N   -rW   rX   s     r&   r[   zMTestTimeConversionFormats.test_to_datetime_format_integer.<locals>.<listcomp>+  s9    RRRa9QrrUS[1QRR5%899RRRr(   rv   r^   rb   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]   rz   r   r   )r6   int_dater9   r8   s       r&   .test_int_to_datetime_format_YYYYMMDD_typeerrorzHTestTimeConversionFormats.test_int_to_datetime_format_YYYYMMDD_typeerror0  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.%frF   )calendar
month_abbrr   r   strptime)r6   r'   r   valrG   r8   exps          r&   #test_to_datetime_format_microsecondz=TestTimeConversionFormats.test_to_datetime_format_microsecondF  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 rM   r   )r6   r'   valuerG   dts        r&   test_to_datetime_format_timez6TestTimeConversionFormats.test_to_datetime_format_timeO  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)rG   exactr'   z(\d+\w+\d+))expandrF   )r   r   r`   extractr4   ra   r}   s        r&   test_to_datetime_with_non_exactz9TestTimeConversionFormats.test_to_datetime_with_non_exact~  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rG   r   r   )r6   r'   rG   r9   r8   s        r&   (test_non_exact_doesnt_parse_whole_stringzBTestTimeConversionFormats.test_non_exact_doesnt_parse_whole_string  s8    4 .vU
 
 
 !!!!!!r(   rO   )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   rF   r   )r6   r'   rO   r9   r8   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 rM   r   )r6   r   fmtr9   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 UTCri   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   r4   rH   )r6   r   datesexpected_datesr8   r9   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 errorrk   r   )r4   assert_produces_warningFutureWarningr   r   rH   )r6   r   r   r   msgr8   r9   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rG   utcr   r   r4   r5   )r6   r   r   r   r8   r9   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:01r   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. rk   r   joinPARSING_ERR_MSGrn   ro   rp   r   )r6   r  r   r   r   s        r&   )test_to_datetime_parse_timezone_malformedzCTestTimeConversionFormats.test_to_datetime_parse_timezone_malformed0  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   r4   r5   )r6   r   rO   r8   r9   s        r&   *test_to_datetime_parse_timezone_keeps_namezDTestTimeConversionFormats.test_to_datetime_parse_timezone_keeps_nameB  s`    $,-E:::S--- "7!8UOOO
fh/////r(   )3__name__
__module____qualname__rn   markparametrizer:   r   rK   rP   rd   rr   rw   r~   r   r   r0   rm   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  rV   r(   r&   r*   r*   U   s.       [Z$770 0 870 [ :&&		*(=(=yy?T?TU
 :&&		*(=(=yy?T?TU		
 * * * [000000000000000000	

 
" "
 
"
1 1 1< < <4
1 
1 
1	1 	1 	1	0 	0 	01 1 1 [ +**RV,S)+++&&&x(x%'''	
 1 1 1 [ 
BFJ
CDD		*--rvrvrvFGG 
J
BFCDD		*--rvrvrvFGG "&(H=>>		*--rvrvrvFGG (BFH=>>		*--rvrvrvFGG#	
 21 13 21 [ eWnmmUG&<&<=eWdMM5'223()u&;<==
 --u8M*N*NO--u8M*N*NOBFBE"D--8M8M8M*N*NOBFBE"Hmm<Q<Q<Q.R.RS	
  0 0!  0
0 0 01 1 1 [ xxb"--.XXdAq))*$x g4L	
 "" "# ""
   [!199=O3P3PQ!199=O3P3PQ%#	/00 FL%#	,--k''$F$&&q)-??Q  (  		 	 	 FL%#	,--k''$F$&&q)-??Q  (  		 	 	 FL(&	/00k''$F$&&q)-??Q  (  		 	 	=(	
+ +XD DY+ +XD 1 1 1 [4A../4A../IIdAq"556IIdAq"556yyq!R<<=yyq!R<<= ))D!QB"C"CD ))D!QB"C"CD#YYtQ2r2v%N%NO#YYtQ2r2v%N%NO(	$1b"b&[III
 )	$1b"b&[III	
 ." "/ ." [	
 	
 	
	 	" "	 	" [))L"9"9:))L"9"9:	
 G G G [" '*+a/0U;;;<q@ &+,q0I-hhyyQS?T?T?T6U6U  
 	 ',-1I-hhyyQS?T?T?T6U6U  
 	 '(*ABI-6Fd6Fq6I6I   I3<LD<LQ<O<OPPP		5$	
' 'P* *Q' 'P* [" '   I3>>>I3>>>I3EEE ',.IJI-hhyyQS?T?T?T6U6U   I-hhyyQT?U?U?U6V6V  		
 <* *= <*0 0 0( [DDD , , ,0 0 0 0 0r(   r*   c                      e Zd Zej                            d          d             Zd Zd Zej        	                    dddgdd	g
          d             Z
ej        	                    dddgddg
          ej        	                    d ej        dddg eddgd          d           ej        dddg eddg          d           ej        dddg eddgd          d           ej        dd dg eddgd          d!          g          ej        	                    d"ed# g          d$                                     Zej        	                    dddgddg
          ej        	                    d"ed% g          d&                         Zej        	                    d' ej        d e ed(d)*           ed+d,*          eg          d-           ej        d e ed(d)*           ed.d,*          eg          d/          g          d0             Zej        	                    d' ej        d eg d1d          d2           ej        d eg d3d          d4          g          d5             Zej        	                    dddgddg
          ej        	                    d6 ej        dd7gd8          g          ej        	                    d"ed9 g          d:                                     Zd; Zej        	                    d<d=d> ed?d@dAdBdB          gdCd> edDdEdEdBdB          gdFd> edDdEdGdBdB          gg          dH             Zej        	                    dIg dJg dKg dLg dMg dNg dOg dPg dQg dRg dSg dTg dUg dVg dWg dXg dYg dZg d[g d\g          ej        	                    d]g d^          d_                         Zej        	                    d`dadbg          dc             Zej        ej        	                    ddeeg          ej        	                    deddg          ej        	                    d`dadbg          df                                                 Zdg Zdh Zdi Z ej        dj             Z!ej        ej        	                    d`dkdlg          dm                         Z"ej        	                    dndodpg          dq             Z#ej        	                    drg ds          ej        	                    dtdudvg          dw                         Z$ej        	                    dx e%j&        dy           e%j&        dz          g          d{             Z'ej        	                    d|d}d~g          d             Z(ej        	                    dx e%j&        d           e%j&        d          g          ej        	                    d]g d          d                         Z)ej        j*        d             Z+ej        	                    dddg          d             Z,d Z-d Z.d Z/d Z0d Z1d Z2ej        	                    deefe3efe%j4        efeefg          d             Z5ej        	                    dd edde*          gd edde*          gg          d             Z6d Z7d Z8ej        	                    dddg          d             Z9d Z:ej        	                    dnddg          d             Z;d Z<ej        	                    dne=e>g          d             Z?ej        	                    d]g d          d             Z@ej        	                    dddg          ej        	                    ddadg          d                         ZAej        	                    ddg          ej        	                    ddadg          d                         ZBej        	                    ddgdgg dg          ej        	                    ddadg          d                         ZCej        	                    deddag          ej        	                    dddag          ej        	                    d"e3eDe%j4        eeEg          d                                     ZFd ZGej        	                    deddag          ej        	                    dddag          d                         ZHd ZIej        	                    ddae%jJ        fefeKz  z   efeKdz   z  fda ed          fefeKz  z   e ed          fefeKz  z   fdefeKz  z   d ed          fz   efeKdEz   z   ed           ed          fz   ff          d             ZLej        	                    dddg          ej        	                    d eegdz  dagdz  z   d           eegdz  dagdz  z   d           edagdz             edagdz             edgdz             edgdz             eeMjN        gdz             eeMjN        gdz             ee%jJ        gdz             ee%jJ        gdz            g
          d                         ZOej        	                    dg d          d             ZPd ZQej        	                    dddg          ej        	                    d eddEdE           eRddEdE           e%j&        dȦ          ddg          dʄ                         ZSej        	                    dd eeeg          fd eddgeT          fg          dЄ             ZUdф ZVd҄ ZWdӄ ZXdԄ ZYdՄ ZZdք Z[ej        	                    d edئ           edd٬*          f eddڬ*           edd٬*          fg          d܄             Z\ej        	                    dg dޢ          d߄             Z]d Z^d Z_ej        	                    dddgd eddڬ*          gd eddEdEd e`ja        d                    gg          d             ZbdaS )TestToDatetimezignore:Could not infer formatc                    d}d}t          j        t          |          5  t          |           d d d            n# 1 swxY w Y   t          j        t          |          5  t          |g           d d d            n# 1 swxY w Y   t          |d          }|t          u sJ t          |gd          }t          j        |t          t          g                     t          |d          }t          |t                    r||k    sJ t          |gd          }t          j        |t          |gt                               d S )N08335394550z:Parsing "08335394550" to datetime overflows, at position 0rk   r   r|   rz   r-   )rn   ro   r   r   r   r4   r5   r   
isinstancer`   r2   )r6   rO   r   ress       r&   test_to_datetime_overflowz(TestToDatetime.test_to_datetime_overflowL  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_convertr4   r5   )r6   d1d2r'  r9   s        r&   *test_to_datetime_mixed_datetime_and_stringz9TestToDatetime.test_to_datetime_mixed_datetime_and_stringc  s    dAq"Xyq7I7I7I6I-J-JKKKdAq"Xyq7I7I7I6I-J-JKKK3R899Bx((33HYs=S=S=S4T4TUU
c8,,,,,r(   c                    ddg}t          d |D                       }t          |d          }t          |d d d         d          d d d         }t          |          }t          |d d d                   d d d         }t          j        ||           t          j        ||           t          j        ||           t          j        ||           d S )Nz
2016-01-01r   c                 ,    g | ]}t          |          S rV   rW   rX   s     r&   r[   zLTestToDatetime.test_to_datetime_mixed_string_and_numeric.<locals>.<listcomp>n  s    !=!=!=1)A,,!=!=!=r(   mixedr   )r   r   r4   r5   )r6   valsr9   r8   result2result3result4s          r&   )test_to_datetime_mixed_string_and_numericz8TestToDatetime.test_to_datetime_mixed_string_and_numerick  s    a  !=!=!=!=!=>>T'222d44R4j999$$B$?%%TTrT
++DDbD1
fh///
gx000
gx000
gx00000r(   rG   r   r   ISO8601non-ISO8601idsc                     t          ddd          }t          d|g|          }t          ddgd          }t          j        ||           d S )	Nr*  r   ri   
2020-01-01r   z
2020-01-02r   r-   )r   r   r   r4   r5   )r6   rG   r/  r'  r9   s        r&   &test_to_datetime_mixed_date_and_stringz5TestToDatetime.test_to_datetime_mixed_date_and_stringy  s\    
 $1<,V<<< ,!=XNNN
c8,,,,,r(   r   %Y-%d-%m %H:%M:%S%zr   znon-ISO8601 formatzISO8601 formatzutc, args, expectedTz2000-01-01 01:00:00-08:00z2000-01-01 02:00:00-08:00z2000-01-01 09:00:00+00:00z2000-01-01 10:00:00+00:00datetime64[ns, UTC]r-   zall tz-aware, with utc)idFz2000-01-01 01:00:00+00:002000-01-01 02:00:00+00:00zall tz-aware, without utcz%all tz-aware, mixed offsets, with utc2000-01-01 01:00:00z+tz-aware string, naive pydatetime, with utcconstructorc                 D    t          |                                           S Nr   to_pydatetimerZ   s    r&   <lambda>zTestToDatetime.<lambda>      ill88:: r(   c                      ||d                   }|d         }t          ||g||          }t          j        ||           d S )Nr   r   r  r   )	r6   r   r  argsr9   rG  ts1ts2r8   s	            r&   6test_to_datetime_mixed_datetime_and_string_with_formatzETestToDatetime.test_to_datetime_mixed_datetime_and_string_with_format  sR    p k$q'""1gc3Z===
fh/////r(   c                 D    t          |                                           S rI  rJ  rL  s    r&   rM  zTestToDatetime.<lambda>  rN  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 )NrF  rE  r   r   r   z2000-01-01 02:00:00+0000r   r   rk   Fr  )r   r   r4   r   r   r   r5   )	r6   r   rG  rP  rQ  rR  r   r9   r8   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   rk   z2000-01-01 09:00:00+01:00z2000-01-02 02:00:00+02:00NFr  r4   r   r   r   r5   )r6   r   r9   r   r8   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)r[  z2000-02-01 00:00:00+00:00r   znon-ISO8601, UTCc                 X    t          g d|d          }t          j        ||           d S )NrX  Tr  r   )r6   r   r9   r8   s       r&   (test_to_datetime_mixed_offsets_with_nonez7TestToDatetime.test_to_datetime_mixed_offsets_with_none  sB    . LLL
 
 

 	fh/////r(   rP  z2000-01-01 02:00:00-07:00z*all tz-aware, mixed timezones, without utcc                 D    t          |                                           S rI  rJ  rL  s    r&   rM  zTestToDatetime.<lambda>4  rN  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=Truerk   Fr  rn   ro   rp   r   )r6   r   rP  rG  rQ  rR  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   )
r0   str_r   r   r   ilocr   r4   r5   ra   )r6   r   rc   r   r'  r9   s         r&   test_to_datetime_np_strz&TestToDatetime.test_to_datetime_np_strC  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   )r6   s_formatr   s       r&   %test_to_datetime_iso_week_year_formatz4TestToDatetime.test_to_datetime_iso_week_year_formatW  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)ro  z1999 Mondayz%G %A)ro  z1999 Monz%G %a)ro  1999 6z%G %w)ro  rp  z%G %u)ro  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)rm  1999 51 Sundayz%Y %V %A)rm  1999 51 Sunz%Y %V %a)rm  	1999 51 1z%Y %V %w)rm  ru  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)rv  rs  %V %A)rv  rt  z%V %a)rv  ru  z%V %w)rv  ru  z%V %u)rr  rn  z%G %j)rv  z	20 Mondayrx  r|   raiser   rz   c                     t          j                    dk    r_t          j                    dk    rJt          j        t          |          5  t          |||           d d d            d S # 1 swxY w Y   d S d S d S )N)r   UTF-8)r   r|  rk   r   )r  r  rn   ro   rp   r   )r6   r   rj  rk  r|   s        r&   test_error_iso_week_yearz'TestToDatetime.test_error_iso_week_yearc  s    @ !3338H8J8J O
 9
 9
 z555 > >Agf====> > > > > > > > > > > > > > > > > >	 43 9
 9
   
A**A.1A.r   Nz
US/Centralc                 d    t          ddd|          }|j        }t          |          }||u sJ d S )N
1965-04-03   2Wperiodsfreqr   )r   _datar   )r6   r   dtir7   r8   s        r&   test_to_datetime_dtarrz%TestToDatetime.test_to_datetime_dtarr  s?     rDDDiS!!}}}}}}r(   	arg_classr  c                 .   t          j        d          }t          ddd|          } ||          }|                    t	          j        |                    d|                              }t          ||          }t          ||                              t	          j        |                    d|s|nd	                              }|s|t          ur||u sJ |t          u rt          j
        ||           d S t          j        ||           d S )
Npyarrowr  r  r  r  ns)unitr   r  r   )rn   importorskipr   astyper   
ArrowDtype	timestampr   r   r4   ra   r5   )	r6   r   r  r  par  	dti_arrowr8   r9   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   r6   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, 1999rz   r%  r   )r6   rc   s     r&   "test_to_datetime_unparsable_ignorez1TestToDatetime.test_to_datetime_unparsable_ignore  s+    3x000C777777r(   c                    t          j        d          5  t          d                              d          }t	          d          }t	          dg          d         }t          |j        |j        z
            dk     sJ t          |j        |j        z
            dk     sJ |j        J |j        J 	 d d d            d S # 1 swxY w Y   d S )N
US/Easternnowr  r       _B)r4   set_timezoner   as_unitr   abs_valuer   )r6   r  pdnowpdnow2s       r&   test_to_datetime_nowz#TestToDatetime.test_to_datetime_now  s    _\** 	) 	)E""**400C&&E %))!,F u|cj011D8888v}sz122T9999<'''=((((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)s   BCCCzPacific/AucklandzUS/Samoac                 ,   t          j        |          5  t          j        d                              d                              t          j                  }t          d          }t          dg          d         }t          d                              d          }t          j	                                        d          }t          |                                j        |z
            dk     sJ t          |                                j        |z
            dk     sJ t          |j        |j        z
            dk     sJ t          |j        |j        z
            dk     sJ |j        J |j        J 	 d d d            d S # 1 swxY w Y   d S )Ntodaydatetime64[ns]r   r  r  )r4   r  r0   
datetime64r  int64r   r   r  r  r  	normalizer  r   )r6   r   nptodaypdtodaypdtoday2tstodaytstoday2s          r&   test_to_datetime_todayz%TestToDatetime.test_to_datetime_today+  s    _R   	+ 	+mG,,334DEELLRXVVG!'**G"G9--a0H((0066G ((0066H w((**1G;<<tCCCCx))++2W<==DDDDw~677$>>>>w~7884????>)))?****!	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+s   E&F		FFrO   r  r  c                 &    t          |g           d S rI  r   )r6   rO   s     r&   (test_to_datetime_today_now_unicode_bytesz7TestToDatetime.test_to_datetime_today_now_unicode_bytesF  s    SEr(   zformat, expected_ds))r   
2020-01-03)rB  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  rC  r-   r   )r   r   getattrr   maxtotal_seconds)r6   rG   expected_dsstring	attributer8   r9   s          r&    test_to_datetime_now_with_formatz/TestToDatetime.test_to_datetime_now_with_formatJ  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   rN   )r6   r'   r   s      r&   test_to_datetime_dt64sz%TestToDatetime.test_to_datetime_dt64sa  s.     2U+++y}}<<<<<<r(   arg, format)
2001-01-01r   )z
01-01-2001z%d-%m-%Yc                     t          |t          j        d          g|          }t          ddg          }t	          j        ||           d S )Nr@  r   r  )r   r0   r  r   r4   r5   )r6   rO   rG   r8   r9   s        r&   test_to_datetime_dt64s_and_strz-TestToDatetime.test_to_datetime_dt64s_and_strg  sP     c2=#>#>?OOO ,!=>>
fh/////r(   z
1000-01-01z
5000-01-02)rz  rz   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r|   r'   rj  )r   r&  r   r  asm8)r6   r'   r   r|   tss        r&   'test_to_datetime_dt64s_out_of_ns_boundsz6TestToDatetime.test_to_datetime_dt64s_out_of_ns_boundst  sy     F%888"i(((((w#~~~~w"}}}}r]]w#~~~~w"}}}}}}r(   c                    t          j        t          j        t           j                  j        d          }d}t          j        t          |          5  t          |           d d d            n# 1 swxY w Y   t          j        t          |          5  t          |d|           d d d            n# 1 swxY w Y   t          |d|          t          u sJ d S )NDz7Out of bounds second timestamp: 25252734927768524-07-27rk   rz  r  r   )r0   r  iinfor  r  rn   ro   r   r   r   r   )r6   r'   dt64r   s       r&   $test_to_datetime_dt64d_out_of_boundsz3TestToDatetime.test_to_datetime_dt64d_out_of_bounds  sE   }RXbh//3S99G].c::: 	 	dOOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	].c::: 	; 	;WE::::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 4>>>#EEEEEEs$   A00A47A4B55B9<B9r  rj  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 rV   r   r  rX   s     r&   r[   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 rV   r  rX   s     r&   r[   zBTestToDatetime.test_to_datetime_array_of_dt64s.<locals>.<listcomp>  r  r(   r   
9999-01-01rz  r%  r   r  r   r   rz   )r0   r  r   r   r4   r5   r   r  r   r1   r   )r6   r'   r  dtsr8   r9   dts_with_oobs          r&   test_to_datetime_array_of_dt64sz.TestToDatetime.test_to_datetime_array_of_dt64s  s   
 M,--M,--
  S... 	W$%E%E%E%E%EWUUUHH$%E%E%E%E%EXVVVH
fh/// bmL99:: 	L1111\(%HHH 	L$<?++0)LO2L2L2QRUWW% HH
 %RXl'%J%J%JKKH
fh///
 \(%HHH 	+\**H
fh/////r(   c                     t          t          j        d          d          }t          j        d          }||k    sJ d S )Nr  rz   r%  )r   r0   r  r   s      r&    test_out_of_bounds_errors_ignorez/TestToDatetime.test_out_of_bounds_errors_ignore  sD    R]<88JJJ=..!!!!!!r(   c                 $   d}t          j        t          |          5  t          t	          dt
          j        g          d          }d d d            n# 1 swxY w Y   t	          dt
          j        g          }t          j        ||           d S )Nerrors='ignore' is deprecatedrk   z
2362-01-01rz   r%  )r4   r   r   r   r   r0   rm   ra   )r6   r   r'  r   s       r&   !test_out_of_bounds_errors_ignore2z0TestToDatetime.test_out_of_bounds_errors_ignore2  s    -'SAAA 	O 	OflBF%;<<XNNNC	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	OlBF+,,
sC(((((s   +AAAc                     t          dd          t          dd          g}t          ||          }t          ddgd          }t          j        ||           d S )Nz2013-01-01 13:00:00-0800r   r   z2013-01-02 14:00:00-0800r   2013-01-01 13:00:002013-01-02 14:00:00r   r   r   r4   r5   )r6   r'   r7   r8   r9   s        r&   test_to_datetime_tzz"TestToDatetime.test_to_datetime_tz  s{     0\BBB0\BBB
 S... "$9:|
 
 
 	fh/////r(   c                 \   t          dd          t          dd          g}d}t          j        t          |          5  t	          ||           d d d            n# 1 swxY w Y   d	}t          j        t          |          5  t	          ||d
          }d d d            n# 1 swxY w Y   t          t          d          t          d          gd          }t          j	        ||           t	          ||d          }t          ddgd          }t          j	        ||           d S )Nr  r   r   r  r  zLTz-aware datetime.datetime cannot be converted to datetime64 unless utc=Truerk   r   r  rz   )r'   r|   z2013-01-01 13:00:00-08:00z2013-01-02 14:00:00-05:00r2   r-   r   r   zdatetime64[ns, US/Pacific])r   rn   ro   rp   r   r4   r   r   r   r5   r   )r6   r'   r7   r   depr_msgr8   r9   s          r&   test_to_datetime_tz_mixedz(TestToDatetime.test_to_datetime_tz_mixed  s    +===+===

6 	 ]:S111 	* 	*5))))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 3'XFFF 	D 	D E(CCCF	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D566566 
 
 
 	fh///Sh??? (%08T
 
 
 	fh/////s$    AA"%A"B%%B),B)c                    d}d}|gdz  |gdz  z   }t          d |D                       }d}t          j        t          |          5  t	          ||          }d d d            n# 1 swxY w Y   t          j        ||           d S )NMarch 1, 2018 12:00:00+0400March 1, 2018 12:00:00+0500rT   c                 ,    g | ]}t          |          S rV   r	   rX   s     r&   r[   zETestToDatetime.test_to_datetime_different_offsets.<locals>.<listcomp>  s    000q%((000r(   r   rk   r   )r   r4   r   r   r   r5   )r6   r'   ts_string_1ts_string_2r7   r9   r   r8   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'   r[  2000-06-01 07:00:00+00:00rC  r.   r  )r  r   r0   r1   localizer   r2   r   r   r4   r5   )r6   r'   
us_easternr7   r8   r9   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rG   r  r'   )r   r   r4   rH   )r6   r'   init_constructorend_constructorr   expected_datar8   r9   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   )r6   r'   scalarr9   r8   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   r4   ra   )r6   r'   r  r8   r9   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   r4   ra   )r6   r'   r  expected_tsr   r8   r9   s          r&   4test_to_datetime_utc_true_with_series_tzaware_stringzCTestToDatetime.test_to_datetime_utc_true_with_series_tzaware_stringB  sn    (+rdQhTt59999[U;;;<q@AA
vx00000r(   zdate, dtype)r  r  )r  rC  c                     t          t          dd          gd          }t          t          |g|          d|          }t          j        ||           d S )Nr  r   r   M8[ns, UTC]r-   Tr  r   r   r   r4   ra   )r6   r'   r   r.   r9   r8   s         r&   1test_to_datetime_utc_true_with_series_datetime_nsz@TestToDatetime.test_to_datetime_utc_true_with_series_datetime_nsJ  sl     ,7778
 
 
 VTF%888d%PPP
vx00000r(   c                    t          j        d          }|                    dd           }|                    dd           }t          j        t          ddddd|	          t          dd
ddd|	          gt                    }t          |dd|          }t          ddgdd           }t          j
        ||           t          dg|                    dd                     }	t          |	          sJ t          |	d|          }t          j
        ||	           t          |	dd|          }t          dgd          }t          j
        ||           d S )Nzpsycopg2.tzi)r  r  ir   r   r   r   r   r  r-   r   T)r|   r  r'   r[  r  rC  r  z2000-01-01 08:00:00r   r  z2000-01-01 13:00:00)rn   r  FixedOffsetTimezoner0   r1   r   r2   r   r   r4   r5   r   )
r6   r%   r'   psycopg2_tztz1tz2r7   r8   r9   is
             r&   test_to_datetime_tz_psycopg2z+TestToDatetime.test_to_datetime_tz_psycopg2X  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\]rk   r   r  rz   )rn   ro   	TypeErrorr   r   )r6   r'   rO   r   s       r&   test_datetime_boolz!TestToDatetime.test_datetime_bool~  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 datetimerk   Fr   zA^time data "True" doesn\'t match format "%Y%m%d", at position 1. r
  20130101Tr   g        r   r  )typern   ro   r"  r   r   r  rp   r  r4   r5   r   r   r6   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 datetimerk   )rn   ro   r"  r   )r6   rO   r   s      r&   test_datetime_invalid_datatypez-TestToDatetime.test_datetime_invalid_datatype  s     /]9C000 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   ;??)r   rz  rz   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%rk   z00:00:00zH%:M%:S%r   r`  )r6   r|   s     r&   test_invalid_format_raisesz)TestToDatetime.test_invalid_format_raises  s     ]J
 
 
 	H 	H ZGGGG	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H   =AAr   az00:01:99z%H:%M:%Sc                 h   t          |d|          }||k    sJ t          |d|          }|t          u sJ d                    dt           dddt           dd	t           d
g          }t          j        t          |          5  t          |d|           d d d            d S # 1 swxY w Y   d S )Nrz   r|   rG   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. ^second must be in 0..59: 00:01:99, at position 0$rk   rz  )r   r   r  r  NOT_99rn   ro   rp   r6   r   rG   r'  r   s        r&   test_datetime_invalid_scalarz+TestToDatetime.test_datetime_invalid_scalar  s-    %@@@e||||%@@@czzzzhh&"& & &O5"15 5 5NFNNN	
 	
 ]: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 )Nrz   r0  r   z:^time data ".*" doesn\'t match format ".*", at position 0.rk   rz  z!^Out of bounds .*, at position 0$)r   r   rn   ro   rp   r   r7  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rJ   )r.  bz99:00:00c           	      Z   |t          |          dk    rt          }nd }t          j        |dd          5  t	          |d|          }d d d            n# 1 swxY w Y   t          j        |t          ||dnd	                     t          j        |dd          5  t	          |d
|          }d d d            n# 1 swxY w Y   t          j        |t          t          gt          |          z                       d	                    ddt           ddt           ddt           dg          }t          j        t          |          5  t          j        |dd          5  t	          |d|           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nr   Could not infer formatFrl   raise_on_extra_warningsrz   r0  r2   r`   r-   r   r	  r2  r1  r
  r3  r4  r5  rk   rz  )lenUserWarningr4   r   r   r5   r   r   r   r  r  r6  rn   ro   rp   )r6   rJ   rG   warnr'  r   s         r&   test_datetime_invalid_indexz*TestToDatetime.test_datetime_invalid_index  s;    >c&kkAooDDD'0%
 
 
 	F 	F fXfEEEC	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	vXXUKKK	
 	
 	
 '0%
 
 
 	F 	F fXfEEEC	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	c=#V1D#E#EFFFhhO&"& & &5"15 5 5NFNNN	
 	
 ]:S111 	C 	C+4e   C C F76BBBBC C C C C C C C C C C C C C C	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	CsY   AAA B??CCF )F<F F	F F	F  F$'F$z%Y%m%d %H:%M:%Sc                     d}|gdz  } ||          }t          |||d          }t          |||d          }t          j        ||           d S N20130101 00:00:00順 T)r  rG   r'   Fr   )	r6   r  rG   rG  r   
test_datesr   r8   r9   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   r4   r5   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 rE  r   )r6   r  rG   r   rH  r   r8   r9   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 )NrF  Tr   rN   )r6   r   r8   r9   s       r&   test_to_datetime_cache_scalarz,TestToDatetime.test_to_datetime_cache_scalar  s>    "T...011!!!!!!r(   zdatetimelikes,expected_valuesri   z
2012-07-26rI  z2012 July 26c                     t          |d          }t          |d          }t          |d          }t          j        ||           d S )Nr2   r-   r   r%  r  r   )r6   datetimelikesexpected_valuesrc   result_seriesexpected_seriess         r&   *test_convert_object_to_datetime_with_cachez9TestToDatetime.test_convert_object_to_datetime_with_cache   sg    0 
 
 
 $C999 "
 
 
 	}o>>>>>r(   r'   input   r2   r   r   c                     t          t          gt          |          z  d          }t          ||          }t	          j        ||           d S )Nr   r-   r   )r   r   r@  r   r4   ra   )r6   r'   rX  r9   r8   s        r&   *test_to_datetime_converts_null_like_to_natz9TestToDatetime.test_to_datetime_converts_null_like_to_natC  sN    $ 3%#e**,H===U%000
vx00000r(   zdate, format))z2017-20z%Y-%W)	20 Sundayz%W %A)20 Sunz%W %a)z2017-21z%Y-%U)r\  z%U %A)r]  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 yearrk   r   r`  )r6   r   rG   r   s       r&   'test_week_without_day_and_calendar_yearz6TestToDatetime.test_week_without_day_and_calendar_yearY  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   rk   r   r%    r   r   r   r   i@8  r   iPF  )	r4   r   r   r   r   r   r   r   r5   r6   
ts_stringsr   r8   r9   s        r&   test_to_datetime_coercez&TestToDatetime.test_to_datetime_coercek  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   r0  rc  r   r   )r   r   r   r   r4   r5   )r6   
string_argrG   rg  re  r8   r9   s          r&   test_to_datetime_coerce_oobz*TestToDatetime.test_to_datetime_coerce_oob~  sY      !+.
ZHHH (4A"6"6!<==
fh/////r(   zerrors, expectedr   rz   200622-12-31111111-24-11c                     ddg}t          j        t          dd          5  t          ||          }d d d            n# 1 swxY w Y   t          j        ||           d S )Nrk  rl  r=  Fr>  r%  )r4   r   rA  r   r5   )r6   r|   r9   re  r8   s        r&   #test_to_datetime_malformed_no_raisez2TestToDatetime.test_to_datetime_malformed_no_raise  s     %n5
'7QV
 
 
 	< 	< !F;;;F	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	fh/////s   ?AAc                    ddg}d}t          j        t          |          5  t          j        t
          d          5  t          |d           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nrk  rl  zParsed string "200622-12-31" gives an invalid tzoffset, which must be between -timedelta\(hours=24\) and timedelta\(hours=24\), at position 0rk   r=  rz  r%  rn   ro   rp   r4   r   rA  r   )r6   re  r   s      r&    test_to_datetime_malformed_raisez/TestToDatetime.test_to_datetime_malformed_raise  s-   $n5
 	
 ]
 
 
 
	 
	 +#;     "                 	
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	s4   A4AA4A 	 A4#A 	$A44A8;A8c                 6   d}t          |          }t          |          }||k    sJ t          t          |          gdz            }t          |gdz            }t          j        ||           t          |gdz            }t          j        ||           d S )N2015-11-18 15:30:00+05:30ri   )r   r   r   r4   r5   )r6   ts_strr8   r9   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 )Nrs  2015-11-18 16:30:00+06:30r   rk   rh     r-  r  r   iXM  r      ih[  r-   )r   r4   r   r   r   r0   r1   r   r   r2   r   r5   rd  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 )Nrs  rw  Tr  rh  rx  r-  r   r   r   )r   r   r   r   r4   r5   )r6   re  r8   r9   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 )Nrm   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 rI  rV   )rY   r  rc   r6  s     r&   	<genexpr>zPTestToDatetime.test_mixed_offsets_with_native_datetime_raises.<locals>.<genexpr>  s0      ??3q6T!W$??????r(   r   rk   r   r-   r5  g?zTz-aware datetime.datetime)r   r   allranger@  r4   r   r   r   rK  r2   ra   rd  r  rn   ro   rp   )r6   r  r  r   r4  r9   rc   r6  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  ri   rc  r   r   r      r   r   )r   r   r   r   r   r4   r5   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   )r6   r  r9   r8   s       r&   test_timestamp_utc_truez&TestToDatetime.test_timestamp_utc_true  s-     RT***!!!!!!r(   dt_str)00010101130001013000010199990101c                     d}t          j        t          |          5  t          |d           d d d            d S # 1 swxY w Y   d S )N"Out of bounds nanosecond timestamprk   r]   r   rn   ro   r   r   )r6   r  r   s      r&   *test_to_datetime_with_format_out_of_boundsz9TestToDatetime.test_to_datetime_with_format_out_of_bounds  s     3].c::: 	1 	1x0000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1r`  c                     t          j        t          d          gt                    }t	          |d          }|j        t          j        u sJ d S )Nz2012-06-13T01:39:00Zr-   Tr  )r0   r1   r
   r2   r   r   r   r  )r6   r7   r8   s      r&   test_to_datetime_utcz#TestToDatetime.test_to_datetime_utc$  sO    h4556fEEESd+++yHL((((((r(   c                     ddl m}  |dd          }t          ddd|          t          ddd|          t          ddd	|          g}t          |          }|j        |k    sJ d S )
Nr   )r   i\z-07:00r   r   r   ri   r   )-pandas.tests.indexes.datetimes.test_timezonesr   r   r   r   )r6   r   	fixed_offr   r8   s        r&   test_to_datetime_fixed_offsetz,TestToDatetime.test_to_datetime_fixed_offset*  s    MMMMMMKh//	 T1a	222T1a	222T1a	222

 U##yI%%%%%%r(   r   z2020-10-26 00:00:00+06:00z2020-10-26 00:00:00+01:00r*  r-  zAustralia/Melbourner   c                     d}t          j        t          |          5  t          |d           d d d            d S # 1 swxY w Y   d S )Nr   rk   Fr  r4   r   r   r   )r6   r   r   s      r&   8test_to_datetime_mixed_offsets_with_utc_false_deprecatedzGTestToDatetime.test_to_datetime_mixed_offsets_with_utc_false_deprecated7  s     L'SAAA 	) 	)%((((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)r`  )cr  r  r  rn   r  filterwarningsr(  r1  r:  r  rA  r#   r   r   rS  rV  r   r   rZ  r]  ra  re  r   rl  r}  r  r  skip_if_windowsr   r  r  r  r  r  r  r  r  r0   r  r  r  r  
skip_ubsanr  r  r  r  r  r  r  r   listr1   r  r  r  r  r  r   r#  r(  boolr   r*  r,  r8  r:  rC  tupler   rI  rM  rO  rQ  rm   r   rW  r   r   r[  r_  rf  r   rj  r2   rn  rq  ru  rz  r|  r  r  r  r  r  r  r  r   r  rV   r(   r&   r"  r"  K  sW       [ ?@@? ? A@?,- - -1 1 1 [:z*M0J   - - - [	 56!#34   
 [FL,.IJ02MN/   ,   FL,.IJ02MN  /   FL,.IJ02MN/   ;   FL&(CD02MN/   A  7$	
' 'P [	::; 
0 
0	 Q' ' b
0 [	 56!#34   
 [	::; 0 0	  0, [FL%!	"<MMM!	"<MMM  &
 
 
 FL%!	"<MMM!	"<MMM  *
 
 
	
 6
0 
07 6
0 [FL%UUU/   "   FL%UUU/   &  	
 *0 0+ *0 [	 56!#34   
 [FL,.IJ?  	
  [	::; ; ;	   $;. . .( [XXdBAq%A%ABXXdAq!Q%?%?@XXdAq!Q%?%?@	
 4 4 4 [                                      [s	
v vn [X'D'D'DEE> > FEov vp> [TD,#788  98 [[65/::[UT5M22[TD,#7884 4 98 32 ;: 4*/ / // / /8 8 8
 ) ) )  [T$6
#CDD+ + ED +2 [UUG$455  65 [	
 	
 	
  [	
 = =  = [}r}\**MBM,,G,GH = = = [&&	
 0 0 0 [}r}\**MBM,,G,GH  [X'D'D'DEE	 	 FE 	 [	F 	F 	F [Vc3Z00*0 *0 10*0X" " ") ) )0 0 00 0 0>
0 
0 
00 0 0, [+M"=!X}%V		
 * * * [		*?E J J JK		*?E J J JK	
 " " "
1 1 11 1 1 [5:	
 1 1 1$0 $0 $0L [UT5M22E E 32E
 
 
& [UT;$788  98 [X'D'D'DEEH H FEH [WsJ&788[Xj'9::> > ;: 98>* [W'<&=>>[Xj'9::B B ;: ?>B" [	se
|/E/E/EG  [X'=>>$C $C ?> $CL [UT4L11[X(94'@AA[]T5"(E5,QRR0 0 SR BA 2100 0 0 [UT4L11[X(94'@AA1 1 BA 211" " " [' rv#*:!::*Q./
 yy../3&;K2KKii--.#:J1JJ
 &++,!99\#:#:;< *Q./9\**IIl,C,CDE		
 (? ?) (? [WtUm44[FC52:+8<<<FC52:+8<<<FD6B;FD6B;FB4"9FB4"9FBE7R<  FBE7R<  FBF8b=!!FBF8b=!!	
 1 1  54 1 [	
 	
 	

 
- -
 
-0 0 0& [	')CD  [HT1a  Dq!BM,''	
	 	0 0	 		 0 [uuc3Z(()uunn=VLLLM	
 0 0 0  (0 0 00 0 0$0 0 0% % %N0 0 0 [Y|$$ii&G&G&GH	,<888	,777	
	 	" "	 	"
 [X'W'W'WXX1 1 YX1) ) )& & & [(*EF())L\*R*R*RS+q!R>S0T0TUUU	

 
) )
 
) ) )r(   r"  c            	       <   e Zd Zej                            dddg          ej                            dd ed          g          d                         Zej                            dddg          d             Zd Z	d	 Z
d
 Zd Zd Zej                            dg d          d             Zej                            dg d          ej                            dddg          d                         Zej                            dg dg degg dg ddgg          d             Zej                            d ed          dd gdd  ed          gg          d!             Zd" Zd# Zd$ Zej                            deeg          d%             Zej                            d&eej        g          d'             Zd( Zd) Zej                            d*d+d,g          d-             Zej                            d*d+d,g          d.             Z d/ Z!dS )0TestToDatetimeUnitr  YMitem   c                 d   t          ||          }t          |gd          }t          |g||          }t          j        ||           t          t          j        |gt                    ||          }t          j        ||           t          t          j        |g          ||          }t          j        ||           t          t          j        |t
          j        g          ||          }|	                                d         sJ t          j        |d d         |           d S )Nr  r   r-   r  r'   r   )
r   r   r   r4   r5   r0   r1   r2   rm   r   )r6   r'   r  r  r%   r  r9   r8   s           r&   'test_to_datetime_month_or_year_unit_intz:TestToDatetimeUnit.test_to_datetime_month_or_year_unit_intJ  s    t$''' "X666dV$e<<<
fh///RXtfF;;;$eTTT
fh///RXtf--DFFF
fh/// RXtRVn55DNNN{{}}Q
fRaRj(33333r(   c                 v   d}d| d}t          j        t          |          5  t          dg|d           d d d            n# 1 swxY w Y   t          j        t          |          5  t          t	          j        dg          |d           d d d            n# 1 swxY w Y   t          j        t          |          5  t          j        t          |          5  t          dg|d           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   t          j        t          |          5  t          dg|d	           d d d            n# 1 swxY w Y   t          dg|d
          }t          t          gd          }t          j        ||           t          j        t          |          5  t          dg|d
          }d d d            n# 1 swxY w Y   t          j        ||           t          dg|          }t          dg|          }t          j        ||           d S )Nz*strings will be parsed as datetime stringsz(Conversion of non-round float with unit=z is ambiguousrk         ?rz  r  r|   z1.5rz   r   r   r-         ?r  r   )rn   ro   rp   r   r0   r1   r4   r   r   r   r   r5   )r6   r'   r  warn_msgr   r'  r9   s          r&   3test_to_datetime_month_or_year_unit_non_round_floatzFTestToDatetimeUnit.test_to_datetime_month_or_year_unit_non_round_float_  s   
 @LLLL]:S111 	: 	:D9999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:]:S111 	D 	D#d7CCCC	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D]:S111 	@ 	@+MJJJ @ @UG$w????@ @ @ @ @ @ @ @ @ @ @ @ @ @ @	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ ]:S111 	; 	;D::::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 3%d8<<<#h///
c8,,,'XFFF 	C 	CugDBBBC	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C
c8,,, 3%d+++s...
c8,,,,,s}   AAA*&BB #B DC>2D>D	DD	DDD;EE"E G  G$'G$c                     d}t          j        t          |          5  t          dgdd|           d d d            d S # 1 swxY w Y   d S )Nz#cannot specify both format and unitrk   r   r  r]   )r  rG   r'   r`  r'  s      r&   	test_unitzTestToDatetimeUnit.test_unit  s     4]:S111 	E 	E#heDDDD	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	Es   A  AAc                     t          j        t                    5  t          dgdd          }d d d            n# 1 swxY w Y   t          dgdd          }t          j        ||           d S )N
1704660000rj  unixr  origini erY  )r6   r'   r'  r9   s       r&   test_unit_strz TestToDatetimeUnit.test_unit_str  s     '66 	G 	G|n3vFFFC	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G
|#fEEE
c8,,,,,s   :>>c           
      <   dddt           t          t          j        ddg}t	          |dd|          }t          dt          d	          t          d	          t          t          t          t          t          gt          
          }t          j	        ||           t	          |dd|          }t          g dd
          }t          j	        ||           d}t          j        t          |          5  t	          |dd|           d d d            d S # 1 swxY w Y   d S )Nl   qMe;r   r  r   r   r  rz   r  r|   r'   
1970-01-02r-   r   )r   r  r  r   r   r   r   r   r   z8cannot convert input 11111111111111111 with the unit 'D'rk   rz  )r   r   r0   rm   r   r   r   r2   r4   r5   r   rn   ro   r   r6   r'   rJ   r8   r9   r   s         r&   test_unit_array_mixed_nansz-TestToDatetimeUnit.test_unit_array_mixed_nans  s   #QT3rJV#heLLL!,'',''	 
 
 
 	fh///V#heLLL RRR
 
 
 	fh///H].c::: 	G 	GSFFFF	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	Gs   0DDDc                    dt           t          t          j        dg}t	          |dd|          }t          dt          t          t          t          gt                    }t          j        ||           t	          |dd|          }t          g dd	          }t          j        ||           d
}t          j        t          |          5  t	          |dd|           d d d            d S # 1 swxY w Y   d S )Nl     #0U.KK% r   rz   rj  r|   r  r'   r-   r   )r   r   r   r   r   r   z@cannot convert input 1420043460000000000000000 with the unit 's'rk   rz  )r   r   r0   rm   r   r   r2   r4   r5   r   rn   ro   r   r  s         r&   $test_unit_array_mixed_nans_large_intz7TestToDatetimeUnit.test_unit_array_mixed_nans_large_int  sH   +T3FVH3eLLL3S#sCHPVWWW
fh///VH3eLLL !D!D!DHUUU
fh///P].c::: 	G 	GwSFFFF	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	Gs   C,,C03C0c                     d}t          j        t          |          5  t          ddd|           d d d            d S # 1 swxY w Y   d S )Nz+non convertible value foo with the unit 's'rk   r  rz  rj  r  r`  r'  s      r&   8test_to_datetime_invalid_str_not_out_of_bounds_valuerrorzKTestToDatetimeUnit.test_to_datetime_invalid_str_not_out_of_bounds_valuerror  s     <]:S111 	F 	FgCuEEEE	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F   ?AAerrorry  c                     t          d          }t          dd||          }||k    sJ t          |t                     sJ d S )Nz1970-05-09 14:25:11iǊ rj  r  )r   r   r&  )r6   r'   r  r9   r8   s        r&   test_unit_consistencyz(TestToDatetimeUnit.test_unit_consistency  sU     233XCUKKK!!!!&),,,,,,,r(   r|   )rz   rz  r   r.   float64r  c                     t          ddgd          }t          j        ddg                              |          }t	          |||          }t          j        ||           d S )N2015-06-19 05:33:202015-05-27 22:33:20r   r-   @CA5Cr  )r   r0   r1   r  r   r4   r5   )r6   r'   r|   r.   r9   r7   r8   s          r&   test_unit_with_numericz)TestToDatetimeUnit.test_unit_with_numeric  st    
 !"$9:(
 
 
 h[12299%@@Su===
fh/////r(   zexp, arr, warning)r   r  r  )r  r  r  )r  r  r   r   )r  r  r  r   Nc                     t          |d          }t          j        |d          5  t          |d|          }d d d            n# 1 swxY w Y   t          j        ||           d S )Nr   r-   r=  rk   r   r  )r   r4   r   r   r5   )r6   r'   r   r7   warningr9   r8   s          r&   test_unit_with_numeric_coercez0TestToDatetimeUnit.test_unit_with_numeric_coerce  s    $ !H555'7OPPP 	D 	D XUCCCF	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D
fh/////s   AAAr7   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 rV   rW   rX   s     r&   r[   z6TestToDatetimeUnit.test_unit_mixed.<locals>.<listcomp>  s    4441)A,,444r(   r   r-   r   r  rz  )r   r   r4   r5   r   )r6   r'   r7   r9   r8   s        r&   test_unit_mixedz"TestToDatetimeUnit.test_unit_mixed  s     44444HEEES???
fh/// S>>>
fh///s##
fh/////r(   c                     d}t          |d|          }t          d          }||k    sJ t          |d          }||k    sJ d S )Ng aArj  r  z2015-06-19 19:55:31.877000093r  rN   )r6   r'   r   r8   r9   alts         r&   test_unit_roundingz%TestToDatetimeUnit.test_unit_rounding  s_     #UE:::<==!!!!C(((f}}}}}}r(   c                     t          dgdz  d          }t          |dd|          }t          j        ||           d S )Ng   Bri   r  r  rz   rj  r  )r   r   r4   r5   r6   r'   r9   r8   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   rj  Trz   )r  r  r|   1970-01-01 00:00:01r  r-   r  r   s      r&   'test_to_datetime_errors_ignore_utc_truez:TestToDatetimeUnit.test_to_datetime_errors_ignore_utc_true  sI    aSsXFFF "7!8NNN
fh/////r(   c                    dt          fdt          d          D                                           |          }t          |d          }t          d t          d          D             d          }t	          j        ||           d S )	NQc                     g | ]}|z   S rV   rV   rY   tepochs     r&   r[   z<TestToDatetimeUnit.test_to_datetime_unit.<locals>.<listcomp>      333Aeai333r(   rY  rj  r  c                 N    g | ]"}t          d           t          |          z   #S z2013-06-09 02:42:28)secondsr   r   rY   r  s     r&   r[   z<TestToDatetimeUnit.test_to_datetime_unit.<locals>.<listcomp>"  A        /009Q3G3G3GG  r(   r   r-   )r   r  r  r   r4   ra   )r6   r.   rc   r8   r9   r  s        @r&   test_to_datetime_unitz(TestToDatetimeUnit.test_to_datetime_unit  s    3333r33344;;EBBSs+++ r   
 
 
 	vx00000r(   nullc                    dt          fdt          d          D             |gz             }t          |d          }t          d t          d          D             t          gz   d          }t	          j        ||           d S )	Nr  c                     g | ]}|z   S rV   rV   r  s     r&   r[   zGTestToDatetimeUnit.test_to_datetime_unit_with_nulls.<locals>.<listcomp>-  r  r(   rY  rj  r  c                 N    g | ]"}t          d           t          |          z   #S r  r  r  s     r&   r[   zGTestToDatetimeUnit.test_to_datetime_unit_with_nulls.<locals>.<listcomp>0  s1    XXXY,--	!0D0D0DDXXXr(   r   r-   )r   r  r   r   r4   ra   )r6   r  rc   r8   r9   r  s        @r&    test_to_datetime_unit_with_nullsz3TestToDatetimeUnit.test_to_datetime_unit_with_nulls*  s    3333r333tf<==Ss+++XXeTViiXXXe
 
 

 	vx00000r(   c                    dt          fdt          j        ddd          D             t          gz                                 t
                    }t          |d          }t          d t          j        ddd          D             t          gz   d	
          }|                    d          }t          j
        ||           d S )Nr  c                     g | ]}|z   S rV   rV   r  s     r&   r[   zOTestToDatetimeUnit.test_to_datetime_unit_fractional_seconds.<locals>.<listcomp>9  s    ???Aeai???r(   r   ri   g      ?rj  r  c                 N    g | ]"}t          d           t          |          z   #S r  r  r  s     r&   r[   zOTestToDatetimeUnit.test_to_datetime_unit_fractional_seconds.<locals>.<listcomp><  r  r(   r   r-   ms)r   r0   aranger   r  rf   r   r   roundr4   ra   )r6   rc   r8   r9   r  s       @r&   (test_to_datetime_unit_fractional_secondsz;TestToDatetimeUnit.test_to_datetime_unit_fractional_seconds6  s    ????1a)>)>???4&HIIPPQVWWSs+++ 1a..   e	
 
 
 
 d##
vx00000r(   c                     t          dddt          t          j        gd          }t	          t          d          t          d          gdgdz  z   d	
          }t          j        ||           d S )Nr   ri   r   r  r  r  
1970-01-03r   r   r-   )r   r   r0   rm   r   r   r4   r5   r   s      r&   test_to_datetime_unit_na_valuesz2TestToDatetimeUnit.test_to_datetime_unit_na_valuesG  sv    aE37cBBB |$$i&=&=>%1L
 
 
 	fh/////r(   bad_valr  ikc                     | d}t          j        t          |          5  t          dd|gd           d d d            d S # 1 swxY w Y   d S )Nz with the unit 'D'rk   r   ri   r  r  r`  )r6   r  r   s      r&   test_to_datetime_unit_invalidz0TestToDatetimeUnit.test_to_datetime_unit_invalidO  s    ,,,]:S111 	3 	3Awc2222	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3s   AA
Ac                     t          t          d          t          d          gdgdz  z   d          }t          dd|gdd	
          }t          j        ||           d S )Nr  r  r   r   r   r-   ri   r  r   r  )r   r   r   r4   r5   )r6   r  r9   r8   s       r&   test_to_timestamp_unit_coercez0TestToDatetimeUnit.test_to_timestamp_unit_coerceU  ss     !|$$i&=&=>%1L
 
 
 aG_3xHHH
fh/////r(   c                 *   d}d}d|z  }t          d|dz
  | dz   gt                    }||z                      t          j                  }dD ]}t          |d|	          }t          j        |                    t          j                                      t          j                  |                    t          j                  d
           t          d|dz   gt                    }t          d| dz
  gt                    }	t          j
        t          |          5  t          |dd	           d d d            n# 1 swxY w Y   t          j
        t          |          5  t          |	dd	           d d d            d S # 1 swxY w Y   d S )Nz"cannot convert input with unit 'D'g  S$Bl            r   g{Gzt?r-   ry  r  r  g|=)rtolrk   rz  )r   rf   r  r0   r  r   r4   assert_almost_equalr  rn   ro   r   )
r6   r   oneday_in_nstsmax_in_daysshould_succeedr9   
error_moderesult1should_fail1should_fail2s
             r&   (test_float_to_datetime_raise_near_boundsz;TestToDatetimeUnit.test_float_to_datetime_raise_near_bounds_  sG   2),%~'=>e
 
 
 #\199"(CC7 	 	J!.s:NNNG "rx((//
;;
++     q-%"78FFFq=.5"89GGG].c::: 	@ 	@3w????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@].c::: 	@ 	@3w????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@s$   #EE	E(FFF)"r  r  r  rn   r  r  rf   r  r  r  r  r  r  r  r  r  rA  r  r   r  r  r  r  intr  r   r0   rm   r  r  r  r  r  r	  rV   r(   r&   r  r  I  s       [Vc3Z00[Vc55::%6774 4 87 104& [Vc3Z00- - 10-@E E E- - -G G G:G G GF F F [W&C&C&CDD- - ED- [X'D'D'DEE[Wy'&:;;0 0 <; FE0 [ FEE111 MLL888	
 0 0 0 [Yz""K=+yy'<'<=	
 0 0 0"	 	 	0 0 00 0 0 [WsEl331 1 431 [VdBF^44	1 	1 54	11 1 1"0 0 0 [Y	(:;;3 3 <;3
 [Y	(:;;0 0 <;0@ @ @ @ @r(   r  c                   <   e Zd Zej        d             Zd Zd Zej        	                    dddddd	d
ddddddddg          d             Z
d Zd Zd Zd Zej        	                    ddgddgg dddgg dg          d             Zd Zd Zd Zd Zd Zd S )!TestToDatetimeDataFramec                 X    t          ddgddgddgddgd	d
gddgddgddgddgd	          S )Nrh    ri   r   r   rT   r     :   ;   r   rx  r   	r  r  r  r  r  secondr  usr  )r   r6   s    r&   dfzTestToDatetimeDataFrame.df|  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   r4   ra   to_dictr6   r  r'   r8   r9   s        r&   test_dataframez&TestToDatetimeDataFrame.test_dataframe  s    Z"W+biHHPU
 
 
 *++Y7I-J-JK
 
 	vx000 R 8 8 89AACC5QQQ
vx00000r(   c                     |g d                                          }d|d<   t          ||          }t          t          d          t          d          g          }t	          j        ||           d S )Nr  ri   r  r   r  z20160205 00:0:00)r  r   r   r   r4   ra   )r6   r  r'   df2r8   	expected2s         r&   &test_dataframe_dict_with_constructablez>TestToDatetimeDataFrame.test_dataframe_dict_with_constructable  s~    )))*2244GS...*++Y7I-J-JK
 
	 	vy11111r(   r  yearsmonthsdaysr,  r   r  )r  r  r  r  r  r  r  r  r  r  r  r  c                    t          |t          |                                                                       |          |          }t	          t          d          t          d          gd          }t          j        ||           d S )Ncolumnsr   z20150204 06:58:10z20160305 07:59:11r   r-   )r   r  keysrenamer   r   r4   ra   )r6   r  r'   r  r8   r9   s         r&   *test_dataframe_field_aliases_column_subsetzBTestToDatetimeDataFrame.test_dataframe_field_aliases_column_subset  s    . RTYY[[ 1 1299$9GGuUUU*++Y7J-K-KL
 
 
 	vx00000r(   c           
          ddddddddd	d
	}t          |                    |          |          }t          t          d          t          d          g          }t	          j        ||           d S )Nr  r  r  r  r  r  r  r  r  r  r%  r   20150204 06:58:10.00100200320160305 07:59:11.001002003)r   r(  r   r   r4   ra   )r6   r  r'   dr8   r9   s         r&   test_dataframe_field_aliasesz4TestToDatetimeDataFrame.test_dataframe_field_aliases  s    

 

 RYYqY11???788788
 
 	vx00000r(   c                     t          |                    t                    |          }t          t	          d          t	          d          g          }t          j        ||           d S )Nr   r+  r,  )r   r  r`   r   r   r4   ra   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 )Nrh  r  ri   rY  r   rT   r  z^^cannot assemble the datetimes: time data ".+" doesn\'t match format "%Y%m%d", at position 1\.rk   r   r   r  r  )
r   rn   ro   rp   r   r   r   r   r4   ra   )r6   r'   r  r   r8   r9   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\]rk   r   r  r   )rn   ro   rp   copyr   )r6   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 missingrk   r   r`  )r6   r  r'   r6  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 keysrh  r  ri   rY  r   rT   r  )r  r  r  rk   r   )r  r  r  r  )r  r  r  r  )r   r&  rn   ro   rp   r   )r6   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 )Nrh  r  ri   r   r   rT   r  int16r   r  20160305 00:00:00)r   r   r  r   r   r4   ra   r6   r'   r  r8   r9   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 )Nrh  r  ri   r   r   rT   r  r  int8r  r   r  r=  )r   r  r   r   r   r4   ra   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.rk   r   )r   rn   ro   rp   r   )r6   r'   r  r   s       r&   test_dataframe_floatz,TestToDatetimeDataFrame.test_dataframe_float1	  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 )Nrh  r  ri   r   r   rT   r  Tr  z
2015-02-04z
2016-03-05r  r-   r   )	r   r   r   r0   r1   r   tz_localizer4   ra   )r6   r  r8   r9   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  rn   fixturer  r  r   r  r  r)  r.  r0  r2  r5  r8  r:  r?  rB  rD  rG  rV   r(   r&   r  r  {  s       ^
 
 ^
1 1 12 2 2 [  !##   "" 	
 *1 1+ *11 1 1,	1 	1 	11 1 1* * * [HW'''e%%%	
	 	/ /	 	/* * *	1 	1 	1	1 	1 	1) ) )1 1 1 1 1r(   r  c                       e Zd Zd Zej                            dddgddgg          d             Zej                            dg d          ej                            d	d
dg          d                         Zej                            dg d          d             Z	ej                            dg d          d             Z
ej                            dg d          d             Zej                            dg d          d             Zej                            dg d          d             Zej                            dg d          d             Zd Zej                            d          d             Zd Zd Zej        d             Zd  Zej        ej                            d!g d"          d#                         Zd$ Zd% Zd& Zd' Zd( Zej                            d) ed*           ed*          g          d+             Z d, Z!d- Z"d. Z#d/ Z$d0 Z%d1 Z&d2 Z'd3 Z(d4 Z)ej                            d5g d6          d7             Z*d8 Z+d9 Z,d: Z-ej                            d;e.e/j0        g          d<             Z1d=S )>TestToDatetimeMiscc                     t          j        dgt                    }d}t          j        t
          |          5  t          |           d d d            d S # 1 swxY w Y   d S )Nz2262-04-11 23:47:16.854775808r-   z6^Out of bounds nanosecond timestamp: .*, at position 0rk   )r0   r1   r2   rn   ro   r   r   )r6   r7   r   s      r&   %test_to_datetime_barely_out_of_boundsz8TestToDatetimeMisc.test_to_datetime_barely_out_of_boundsF	  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   rN   )r6   r'   rO   exp_strr8   r   s         r&   test_to_datetime_iso8601z+TestToDatetimeMisc.test_to_datetime_iso8601P	  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 0rk   r   r`  )r6   rX  rG   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)rT  rS  )rU  r   )rV  r   )rW  r   rX  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. rk   r   r  )r6   rX  rG   r   s       r&   $test_to_datetime_iso8601_exact_failsz7TestToDatetimeMisc.test_to_datetime_iso8601_exact_failsv	  s     hh7$37 7 7&"& & &
 
 ]
 
 
 	. 	. f----		. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s   A$$A(+A()r]  )z2012-01-01 00r   )z2012-01-01 00:00r   )rM  r   c                 \    t          ddd          }t          ||d          }||k    sJ d S )Nr   r   Fr   r   r   r6   rX  rG   r9   r8   s        r&   "test_to_datetime_iso8601_non_exactz5TestToDatetimeMisc.test_to_datetime_iso8601_non_exact	  s@     T1a((U6???!!!!!!r(   ))2020-01z%Y/%m)r@  z%Y/%m/%d)2020-01-01 00z%Y/%m/%dT%H)2020-01-01T00z%Y/%m/%d %H)2020-01-01 00:00z%Y/%m/%dT%H:%M)2020-01-01T00:00z%Y/%m/%d %H:%M)2020-01-01 00:00:00z%Y/%m/%dT%H:%M:%S)2020-01-01T00:00:00z%Y/%m/%d %H:%M:%Sc                     t          j        t          d| d| d          5  t          ||           d d d            d S # 1 swxY w Y   d S )NrZ  z\" doesn\'t match format \"r[  rk   r   r`  )r6   rX  rG   s      r&   "test_to_datetime_iso8601_separatorz5TestToDatetimeMisc.test_to_datetime_iso8601_separator	  s     ]0 0 00 0 0
 
 
 	. 	. f----	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s   AA	A))rd  rS  )r@  r   )re  r   )rf  %Y-%m-%dT%H)rg  r   )rh  %Y-%m-%dT%H:%M)ri  r   )rj  %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.000000rp  )z2020-01-01T00:00:00.000000000rp  c                 Z    t          ddd          }t          ||          }||k    sJ d S Nr*  r   r   ra  rb  s        r&   test_to_datetime_iso8601_validz1TestToDatetimeMisc.test_to_datetime_iso8601_valid	  >    $ T1a((U6222!!!!!!r(   ))z2020-1rS  )z2020-1-1r   )z
2020-1-1 0r   )z
2020-1-1T0rm  )z2020-1-1 0:0r   )z2020-1-1T0:0rn  )z2020-1-1 0:0:0r   )z2020-1-1T0:0:0ro  )z2020-1-1T0:0:0.000rp  )z2020-1-1T0:0:0.000000rp  )z2020-1-1T0:0:0.000000000rp  c                 Z    t          ddd          }t          ||          }||k    sJ d S rr  ra  rb  s        r&   #test_to_datetime_iso8601_non_paddedz6TestToDatetimeMisc.test_to_datetime_iso8601_non_padded	  rt  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:00Zrw  c                 r    t          dddt          j                  }t          ||          }||k    sJ d S )Nr*  r   r   r   )r   r  r   r   rb  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  )r6   r'   rsxps       r&   test_to_datetime_defaultz+TestToDatetimeMisc.test_to_datetime_default	  s6    u---dAq!!Rxxxxxxr(   z1fails to enforce dayfirst=True, which would raise)r   c                     d}t          j        t          |          5  t          j        t
          d          5  t          dd|           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )NzInvalid date specifiedrk   zProvide formatz
01-13-2012Tdayfirstr'   rp  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 )NrC   r   r  r   r   )r   r   r   )r6   r'   rc   r8   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
  rk   rz  r  r   i  r   r-  r  rz   )
r   r  rn   ro   rp   r   r   r   r4   ra   )r6   r'   rc   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   ri   r   index%b %yrF   r   r   r_   r4   ra   )r6   r'   r  r9   r8   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   rF  r   s      r&   test_to_datetime_timezone_namez1TestToDatetimeMisc.test_to_datetime_timezone_name#
  sL    5>STTTT1a((44U;;!!!!!!r(   r|   ry  c                     t          g dg d          }t          |d|          } |j        fd          }t          j        ||           d S )N)r  r  r   r  r  r  r{   c                 *    t          | dd          S )Nr  r   r{   r   )rZ   r'   s    r&   rM  zOTestToDatetimeMisc.test_to_datetime_with_apply_with_empty_str.<locals>.<lambda>3
  s    k!GHERRR r(   r  )r6   r'   r|   r  r9   r8   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   r6   r'   r8   s      r&   test_to_datetime_empty_sttz-TestToDatetimeMisc.test_to_datetime_empty_stt7
  s%    Ru---}}}}}}r(   c                 r    t          ddg|          }t          |                                          sJ d S r  )r   r   r  r  s      r&   test_to_datetime_empty_str_listz2TestToDatetimeMisc.test_to_datetime_empty_str_list<
  s<    b"XU333F||!!!!!!!r(   c                 V    t          d          }t          d|          }||k    sJ d S )Nr   r   ra  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 )NrR  r   r   r   r  s       r&   test_to_datetime_stringsz+TestToDatetimeMisc.test_to_datetime_stringsF
  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)rR  20120101z20120101 12:01:01c                 2    g | ]}t          |           S )r   r   )rY   r  r'   s     r&   r[   zITestToDatetimeMisc.test_to_datetime_strings_variation.<locals>.<listcomp>N
  s&    IIIKe444IIIr(   c                 ,    g | ]}t          |          S rV   rW   )rY   date_strs     r&   r[   zITestToDatetimeMisc.test_to_datetime_strings_variation.<locals>.<listcomp>O
  s     <<<()H%%<<<r(   )r4   r  )r6   r'   r1   r9   r8   s    `   r&   "test_to_datetime_strings_variationz5TestToDatetimeMisc.test_to_datetime_strings_variationL
  sS    999IIII5III<<e<<<
vx00000r(   r8   rR  c                 8    t          ddd          }||k    sJ d S )Nr   r   rW   r   s      r&   'test_to_datetime_strings_vs_constructorz:TestToDatetimeMisc.test_to_datetime_strings_vs_constructorR
  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   1rz   r  Or-   z<^Given date string "1" not likely a datetime, at position 1$rk   rz  )	r   r   r0   r1   r4   rH   rn   ro   rp   )r6   r'   r8   r9   r   s        r&   $test_to_datetime_unprocessable_inputz7TestToDatetimeMisc.test_to_datetime_unprocessable_inputW
  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   rz   r  r   )r6   r'   seriesr8   s       r&   !test_to_datetime_unhashable_inputz4TestToDatetimeMisc.test_to_datetime_unhashable_inputb
  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   )r0   r  viewr  r   r   )r6   r  as_objr  r   s        r&   'test_to_datetime_other_datetime64_unitsz:TestToDatetimeMisc.test_to_datetime_other_datetime64_unitsg
  s    *++00::s##vh''Qx6==------&!!r(   c                     t          dd          }t          |j                  }t          |j                  }t          |          }t          j        ||           d S )NrC   rY  r  )r   r   rJ   r  asi8r4   r5   )r6   rngintsr8   s       r&   !test_to_datetime_list_of_integersz4TestToDatetimeMisc.test_to_datetime_list_of_integersr
  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 overflowrk   z1/1/1700BrG  )startr  r  )rn   ro   r   r   r6   r   s     r&   r(  z,TestToDatetimeMisc.test_to_datetime_overflow|
  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 formatrk   rz  r  )r0   r1   r2   rn   ro   rp   r   )r6   r'   invalids      r&   test_string_invalid_operationz0TestToDatetimeMisc.test_string_invalid_operation
  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 )	NrC   rD   z1/4/2000r-   r   r   r   r   )r0   r1   rm   r2   empty	enumerater   r   r
   r   array_to_datetimer4   r  r   r&  r   assert_numpy_array_equalrJ   )r6   r'   stringsr9   r  r   r8   r7  s           r&   test_string_na_nat_conversionz0TestToDatetimeMisc.test_string_na_nat_conversion
  s     (J
BFJGvVVV8AX...(( 	) 	)FAsCyy )"#Cjj(11!4
vx000gU333'=11111
#FGN;;;;;r(   c                    t          j        dt           j        gt                    }d}t	          j        t          |          5  t          |d|           d d d            n# 1 swxY w Y   t          |d|          }t          |t                    }t          j
        ||           t	          j        t          |          5  t          |d|           d d d            d S # 1 swxY w Y   d S )Nz
1/100/2000r-   r  rk   rz  r  rz   )r0   r1   rm   r2   rn   ro   rp   r   r   r4   r5   )r6   r'   	malformedr   r8   r9   s         r&   'test_string_na_nat_conversion_malformedz:TestToDatetimeMisc.test_string_na_nat_conversion_malformed
  s   HlBF36BBB	 0]:S111 	@ 	@	'????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ YxuEEE&111
fh///]:S111 	@ 	@	'????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@s$   A$$A(+A(C''C+.C+c           
         g d}t          dt          j        dt          j        dg|d          }t          t          d|          t          j        t          d|          t          j        t          d|          g|d          }t          ||          }t          ||          }t          t          j        dd	
          |          }t          d          D ]G}|j        |         }	t          |	          rt          |j        |<   .t          |	|          |j        |<   Ht          j
        ||d           |j        dk    sJ t          j
        ||d           |j        dk    sJ d S )N)r.  r;  cr-  erC   rE   z1/5/2000r  r  r  r   rT   r   r-   r  F)check_names)r   r0   rm   r   r  r  rd  r   r   r4   ra   r  )
r6   r'   idxr  dseriesr8   dresultr9   r  rZ   s
             r&   'test_string_na_nat_conversion_with_namez:TestToDatetimeMisc.test_string_na_nat_conversion_with_name
  s   '''RVZ@RW
 
 
 Je444Je444Je444 

 

 

 V5111gU333"(1H555SAAAq 	? 	?AAAAww ?#&a  #.q#>#>#>a  
vxUCCCC{e####
weDDDD|u$$$$$$r(   r  )hmrj  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  rj  )r0   r.   r   rJ   r  r   r4   r5   )r6   r'   r  r.   baserJ   	exp_dtyper9   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/2014rf  ri   r   rx  r   Tr  r  )	r   r   r0   r1   r   r   r   r4   r5   )
r6   r'   r7   r9   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  rk   F)r   r   r4   r5   r   rA  )r6   warning_msgr7   r9   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
  rk   Tr  )rn   ro   rp   r  r   )r6   r7   s     r&   $test_dayfirst_warnings_invalid_inputz7TestToDatetimeMisc.test_dayfirst_warnings_invalid_input  s     \*]B/>B B B
 
 
 	, 	, d++++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,s   AAAklassc                     t          dd                              d          }|                    d          } ||          } ||          }t          |d          }t	          j        ||           d S )Nz
2015-04-05r   r  r  r   Tr  )r   r(  rF  r   r4   rH   )r6   r  r  r9   objr8   s         r&   test_to_datetime_dta_tzz*TestToDatetimeMisc.test_to_datetime_dta_tz  sy     q11188????5))eCjj5??Sd+++
)))))r(   N)2r  r  r  rL  rn   r  r  rQ  r\  r_  rc  rl  rs  rv  ry  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r  r  r  r  r  r(  r  r  r  r  r  r  r  r  r   r   _from_sequencer  rV   r(   r&   rJ  rJ  E	  s          ["$9:&	
      
 [		
 		
 		
  [WtUm44
; 
; 54 
; [	
 	
 	
	 	. .	 	." [	
 	
 	
 " " " [		
 		
 		
 	. 	. 	. [	
 	
 	
  " "!  " [	
 	
 	
  " "!  " [	
 	
 	
 " " "  
 [QRR	F 	F SR	F# # #3 3 3 1 1 1" " " [X'D'D'DEE
1 
1 FE 
1  
" " "" " "" " "1 1 1 [X		&(9(9;;v;N;N'OPP" " QP"	? 	? 	?/ / /
	 	 	+ + +C C C> > >< < <&@ @ @  %  %  %D [))) J J	 J". . .&. . .,, , ," [W}m6R&STT	* 	* UT	* 	* 	*r(   rJ  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-   )r0   r1   r2   tools _guess_datetime_format_for_array)r6   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  r0   r1   rm   )r6   format_for_string_of_nanss     r&   -test_guess_datetime_format_for_array_all_nanszETestGuessDatetimeFormat.test_guess_datetime_format_for_array_all_nansA  sH    $)$JHbfbfbf-S999%
 %
! )00000r(   N)r  r  r  rn   r  r  r0   rm   r  r  r  r  rV   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.%frp  c                     t          t          ddd                    }|                    fd          }t          ||          }t          ||          }t	          j        ||           d S )Nr<   2   r  r  r  c                 .    |                                S rI  )strftime)rZ   r  s    r&   rM  zdTestToDatetimeInferFormat.test_to_datetime_infer_datetime_format_consistent_format.<locals>.<lambda>R  s    ajj.E.E r(   rF   r   )r   r   r_   r   r4   ra   )r6   r'   r  rc   s_as_dt_stringswith_formatwithout_formats     `    r&   8test_to_datetime_infer_datetime_format_consistent_formatzRTestToDatetimeInferFormat.test_to_datetime_infer_datetime_format_consistent_formatJ  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
  rk   r   )r   r0   r1   r  rn   ro   rp   r   )r6   r'   r   rc   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   r0   r1   r   r4   ra   )r6   r'   r   rc   r8   r9   s         r&   "test_to_datetime_consistent_formatz<TestToDatetimeInferFormat.test_to_datetime_consistent_formate  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   r0   r1   rm   r2   r   r   r4   ra   r}   s        r&   !test_to_datetime_series_with_nansz;TestToDatetimeInferFormat.test_to_datetime_series_with_nansn  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   rF  r4   ra   )r6   tz_namer  rc   r8   r   r9   s          r&   "test_infer_datetime_format_tz_namez<TestToDatetimeInferFormat.test_infer_datetime_format_tz_name  s     6W66788S!!i///009%:;;GGKKLMM
vx00000r(   z
ts,zero_tz))r   Z)r   r   )2019-02-02 08:07:13.012345r#  )r$  r   c                     t          ||z   g          }t          |          }|dk    rt          j        nd }t          t	          ||          g          }t          j        ||           d S )Nr#  r   )r   r   r  r  r   r4   ra   )r6   r  zero_tzrc   r8   r   r9   s          r&   "test_infer_datetime_format_zero_tzz<TestToDatetimeInferFormat.test_infer_datetime_format_zero_tz  sm     b7l^$$S!! CTXXT9RB///011
vx00000r(   rG   Nr   c                     t          g d          }t          t          d          t          d          t          d          g          }t          |||          }t          j        ||           d S )N)2014-1-1z2014-2-2z2015-3-3z
2014-01-01z
2014-02-02z
2015-03-03rF   r  )r6   r'   rG   rc   r9   r8   s         r&   %test_to_datetime_iso8601_noleading_0sz?TestToDatetimeInferFormat.test_to_datetime_iso8601_noleading_0s  s|     999::,'','',''
 
 Su===
vx00000r(   c                     t          j        t          d          5  t          dgd           d d d            d S # 1 swxY w Y   d S )Nz2The argument 'infer_datetime_format' is deprecatedrk   z
10-10-2000T)infer_datetime_format)r4   r   rA  r   r  s    r&   .test_parse_dates_infer_datetime_format_warningzHTestToDatetimeInferFormat.test_parse_dates_infer_datetime_format_warning  s    'F
 
 
 	D 	D dCCCC		D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	D 	Ds   <A A )r  r  r  rn   r  r  r  r  r  r  r  r"  r'  r*  r-  rV   r(   r&   r  r  I  sO       [SSS < < <* * *1 1 11 1 11 1 1( [555 1 1	 1 [	
 	
 	
 1 1 1 [Xj'9::1 1 ;:1D D D D Dr(   r  c                      e Zd Zej                            dddgddgddgddgg          d             Zd Zej                            d	ddd
e de	 dfddd
e de	 dfddde	 dfddde	 dfddd
e de	 dfddd
e 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   r|   rG   r'   )r   r   )r6   r'   rO   rG   s       r&   test_day_not_in_month_coercez,TestDaysInMonth.test_day_not_in_month_coerce  s/     KHV5QQQRRRRRRRr(   c                     t           rd}nd}t          j        t          |          5  t	          dd|           d d d            d S # 1 swxY w Y   d S )NzBday 29 must be in range 1..28 for month 2 in year 2015: 2015-02-29z)day is out of range for month: 2015-02-29rk   r0  rz  r  )r   rn   ro   rp   r   r'  s      r&   test_day_not_in_month_raisez+TestDaysInMonth.test_day_not_in_month_raise  s     	>VCC=C]: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s   AAAzarg, format, msg^z. 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 )Nrk   rz  r2  r`  )r6   r'   rO   rG   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 )Nrz   r2  r   )r6   r'   r9   rG   r8   s        r&   test_day_not_in_month_ignorez,TestDaysInMonth.test_day_not_in_month_ignore  s1     XhvUSSS!!!!!!r(   )r  r  r  rn   r  r  r3  r5  DAY_IS_OUT_OF_RANGEr  r8  r:  rV   r(   r&   r/  r/    s        [4 :&:&:&		
 S S SC C C [ ='==?=== ='==?=== 5"15 5 5 5"15 5 5 ='==?=== ='==?===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-11rx  z2005 11z11-2005z11 2005200511r*  rT   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 2014rf  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-   )rW  r'   Sr   )r  r  rW  )r   parse_datetime_string_with_resor   r0   r1   r2   r   r   r   r   r4   r5   r   )r6   r  r9   r'   rW  r  _r7  r8  r9  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   r4   r5   )r6   r'   unique_nulls_fixtureunique_nulls_fixture2r9   r8   s         r&   test_na_values_with_cachez5TestDatetimeParsingWrappers.test_na_values_with_cacheh  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   rY  r   r   r   r   )r6   r  rZ  r7  r8  r9  s         r&   test_parsers_natz,TestDatetimeParsingWrappers.test_parsers_natp  s|    <UCC
e$$E""((+#~~~~#~~~~#~~~~#~~~~~~r(   z'date_str, dayfirst, yearfirst, expectedz10-11-12Fr   Ti  z20/12/21i  rY     c                 ,   t          |||          }||k    sJ t          j        |||          \  }}|s|st          |          }	|	|k    sJ t	          ||||          }
t          |g||          d         }||k    sJ |
|k    sJ ||k    sJ d S )N)r  rW  )r  rW  r'   r   )r
   r   rY  r   r   r   )r6   r'   r  r  rW  r9   dateutil_resultr  rZ  r7  r8  r9  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   rY  r   r   r   )
r6   r  exp_defexp_nowr  rZ  r7  r8  r9  r^  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   rF  r.  repr)r6   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  rn   r  r  r   r`  rd  rf  rj  rn  r   r   rt  rV   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  rj  r  r  r  c                     | j         S )zIDay and some time units.

    * D
    * s
    * ms
    * us
    * ns
    r"   r$   s    r&   unitsrv    s     =r(   c                       t          d          S )zTimestamp at 1960-01-01.
1960-01-01rW   rV   r(   r&   
epoch_1960ry  	  s     \"""r(   c                  :    t          t          d                    S )NrT   )r  r  rV   r(   r&   units_from_epochsr{    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
    >   r}  r  r  r|  r  r|  r  )r#   rK  to_datetime64r`   )ry  r%   s     r&   epochsr    su     =QQQQQ}##	,	&	&'')))	,	&	&''))):r(   c                  R    t          dd                                          j        S )Nr)  r   r  )r   to_julian_daterJ   rV   r(   r&   julian_datesr  (  s$    j"---<<>>EEr(   c                      e Zd Zd Zd Zd Zd Zd Zej	        
                    dddg          d	             Zej	        
                    d
 eddd           eddd          d ej        d          g          d             Zej	        
                    ddefdefdef eddd          efg          d             Zd Zd Zej	        
                    ddefddg          d             Zej	        
                    dg dg dg dg          d             Zej	        
                    d g d!g d"g d#g d$g          d%             ZdS )&
TestOriginc                     t          ddd          }t          d          }||k    sJ t          ddd          }t          d          }||k    sJ d S )Nr   rj  r  z1970-01-01 00:00:02i ʚ;z2001-09-09 01:46:41rN   )r6   r  r9   s      r&   test_origin_and_unitzTestOrigin.test_origin_and_unit.  sd    Q///233X~~~~];;;233X~~~~~~r(   c                     t          t          |dd                    }t          t          |t          d                                          z
  d                    }t	          j        ||           d S )Nr  julianr  r   r  )r   r   r   r  r4   ra   )r6   r  r8   r9   s       r&   test_julianzTestOrigin.test_julian8  sq     Ls8LLLMMy||'B'B'D'DD3OOO
 
 	vx00000r(   c                     t          t          g ddd                    }t          t          d          t          d          t          d          gd	          }t          j        ||           d S )
N)r   r   ri   r  r  r  z
1970-01-01r  r  r   r-   r  r   s      r&   	test_unixzTestOrigin.test_unixB  sv    IIICGGGHH|$$i&=&=y?V?VW
 
 
 	vx00000r(   c                     t          ddd          }|                                dk    sJ d}t          j        t          |          5  t          ddd           d d d            d S # 1 swxY w Y   d S )NiR|% r  r  r  r  z&1 is Out of Bounds for origin='julian'rk   r   )r   r  rn   ro   rp   )r6   r8   r   s      r&   test_julian_round_tripz!TestOrigin.test_julian_round_tripJ  s    WXC@@@$$&&'1111 7]:S111 	6 	6(5555	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6r~  c                     |dk    rJd}t          j        t          |          5  t          ||d           d d d            d S # 1 swxY w Y   d S d S )Nr  z$unit must be 'D' for origin='julian'rk   r  r  r`  )r6   rv  r  r   s       r&   test_invalid_unitzTestOrigin.test_invalid_unitS  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 specifiedrk   z
2005-01-01rx  r  r`  )r6   r  r   s      r&   test_invalid_originzTestOrigin.test_invalid_originZ  s     9]:S111 	F 	F\EEEE	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	F 	Fr  r    r   rx  c                    t          ddd          t          j        dt          j                  }t	          fd|D                       }t	          t          ||                    }t          j        ||           d S )Nr  r   rT   r-   c                 B    g | ]}t          j        |           z   S )r  )r   	Timedelta)rY   rZ   ry  rv  s     r&   r[   z)TestOrigin.test_epoch.<locals>.<listcomp>n  s-    QQQ!R\!%(((:5QQQr(   r  )r   r0   r  r  r   r   r4   ra   )r6   rv  r  r{  r9   r8   ry  s    `    @r&   
test_epochzTestOrigin.test_epocha  s     tQ**
Iarx888QQQQQ?PQQQ
 
 $5E&QQQRR
vx00000r(   zorigin, excr  r  z
13-24-1990c                     d                     d| dd| ddg          }t          j        ||          5  t          |||           d d d            d S # 1 swxY w Y   d S )Nr	  zorigin z is Out of Boundsz# cannot be converted to a Timestampz,Cannot cast .* to unit='ns' without overflowrk   r  )r  rn   ro   r   )r6   r  excrv  r{  r   s         r&   test_invalid_originszTestOrigin.test_invalid_originst  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-naiverk   r   r  r   r   r  )rn   ro   rp   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 1rk   r  	yesterdayr`  r  s     r&   test_incorrect_value_exceptionz)TestOrigin.test_incorrect_value_exception  s     X 	 ]:S111 	0 	0+.///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0r`  zformat, warningN)r   N)r   Nc                     d}t          j        t          |          5  t          d|           d d d            d S # 1 swxY w Y   d S )NzG^Out of bounds nanosecond timestamp: 2417-10-10 00:00:00, at position 0rk   z2417-10-10 00:00:00r   r  )r6   rG   r  r   s       r&   .test_to_datetime_out_of_bounds_with_format_argz9TestOrigin.test_to_datetime_out_of_bounds_with_format_arg  s     Y].c::: 	> 	>-f====	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>r`  zarg, origin, expected_str)( r  z2169-11-13 00:00:00)r  
1870-01-012069-11-13 00:00:00)鼫 r  2169-10-20 00:00:00c                     t          |d|          }t          |          }||k    sJ t          ddd          }t          d          }||k    sJ t          ddd          }t          d          }||k    sJ d S )Nr  r  r  r  r  r  r  rN   )r6   rO   r  expected_strr8   r9   s         r&   test_processing_orderz TestOrigin.test_processing_order  s     Ss6:::\**!!!!YSFFF233!!!!YSFFF233!!!!!!r(   zoffset,utc,exp)r#  T2019-01-01T00:00:00.000Z)r#  Nr  )-01:00Tz2019-01-01T01:00:00.000Z)r  Nz2019-01-01T00:00:00.000-01:00c                     d|z   }t          |gd|          }t          |g                              d          }t          j        ||           d S )Nz2019-01-01T00:00:00.000r  )r  r  )r   r  r4   r5   )r6   r  r  r   rO   r8   r9   s          r&   test_arg_tz_ns_unitzTestOrigin.test_arg_tz_ns_unit  sZ     (&0cU3777u%%--d33
fh/////r(   )r  r  r  r  r  r  r  r  rn   r  r  r  r   r   r0   r  r  rp   r   r  r  r  rA  r  r  r  rV   r(   r&   r  r  -  s         1 1 11 1 16 6 6G G G [VdC[11F F 21F [IdAq!!HT1a  BM,''		
 1 1 1 [j)j!:&XaA 34		
 	F 	F 	FS S S
0 0 0 [;''	
 > > > [#666<<<<<<	
 " " "  [333333888===		
 0 0 0 0 0r(   r  c            
       v   e Zd Zej                            dg ddfg ddfg          d             Zej                            ddd	g          d
             Zej                            d e e	d          gdz             e	d          gdz   e
 e	d          gdz            g          d             ZdS )TestShouldCachezlistlike,do_caching)
r   ri   r   r   rT   r  r  rP  rO  r   F)
r   r   r   r   r   rT   r  r  rP  rO  Tc                 Z    t          j        |t          |          d          |k    sJ d S )Ngffffff?)check_countunique_share)r  should_cacher@  )r6   listlike
do_cachings      r&   test_should_cachez!TestShouldCache.test_should_cache  sA     xS]]QTUUU     r(   z%unique_share,check_count, err_message)g      ?rx  z5check_count must be in next bounds: \[0; len\(arg\)\])r   ri   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 )NrT   r   rk   )rn   ro   AssertionErrorr  r  )r6   r  r  err_messagerO   s        r&   test_should_cache_errorsz(TestShouldCache.test_should_cache_errors  s     cBh]>=== 	? 	?sL+>>>	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?s   AA
A
r  rK  rL  c                 6    t          j        |          du sJ d S )NT)r  r  )r6   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  rn   r  r  r  r  r   r   r  r  rV   r(   r&   r  r    s2       [+++U3+++T2	
 
 
 
 [/OE	
 ? ? ? [UII3445:;;i-../"4UII3445:;;	
 4 4 4 4 4r(   r  c            	         t          g d          } |                     d          } |                                 }t          | d          }t          t	          j        d          t	          j        d          t	          j        d          t	          j        d          t	          j        d          g          }t          j        ||           t          j        | |           d S )	N)r   ri   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  r4  r   r0   r  r4   ra   )rc   ser_copyr'  r9   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 datetimerk   r   )r&  r   rn   ro   r"  r   r   )nulls_fixturer  r8   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r|   ry  zargs, format)z
03/24/2016z
03/25/2016r   r?   )
2016-03-24
2016-03-25r   r   r<  r;  r=  c                     t          |          }t          |||           }t          ddt          gd          }t          j        ||           d S )Nr   r  r  r  r-   )r   r   r   r4   ra   )r|   rP  rG   r  r8   r9   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   rj  r   r  r  r   r  r-   rz  r  r8   r9   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  rf   r   rd  r4   ra   )r'   cstarttimesr8   r9   s        r&   +test_to_datetime_monotonic_increasing_indexr  5  s     Fy((&tDDDENNTN2299FQR9SSE+''))0077$>EKAAAqD)777Fz!!!Q$H68,,,,,r(   series_length(   r   rT   c                 z   t          t          j        d          gt          j        d          g| z  z   t                    }t	          |dd          }t          t
          gt          d          g| z  z             }t          j        ||           t	          |dd          }t          t          j        d          gt          j        d          g| z  z             }t          j        ||           t          j
        t          d	          5  t	          |d
d           d d d            d S # 1 swxY w Y   d S )Nz1446-04-12 00:00:00+00:00z1991-10-20 00:00:00+00:00r-   r   T)r|   r  rz   r  rk   rz  )r   r   fromisoformatr2   r   r   r   r4   ra   rn   ro   r   )r  rc   r  	expected1r7  r  s         r&   2test_to_datetime_cache_coerce_50_lines_outofboundsr  A  s    		 ;	<	<="#>??@=P	R  C
 #hD999G	)7889MIJ I 7I...#hD999G		 ;	<	<="#>??@=P	R I
 7I...	*2V	W	W	W 3 3CT22223 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3s   D00D47D4c            
      n    d} d}t          | |          }t          ddddddd	d
          }||k    sJ d S )Nz15/02/2020 02:03:04.123456789z%d/%m/%Y %H:%M:%S.%fr   r*  ri   r  r   r   r   i  )r  r  r  r  r  r  microsecond
nanosecondrN   )r  timestamp_formatr8   r9   s       r&   %test_to_datetime_format_f_parse_nanosr  a  se    /I-+;<<<F	 	 	H Xr(   c                  x    t          ddgd          } t          ddg          }t          j        | |           d S )Nr@  z2020-01-01 05:00:00r;  r   ri  r  r  s     r&   test_to_datetime_mixed_iso8601r  s  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 2000r4  r   z
2000-01-11z
2000-01-12r  r  s     r&   test_to_datetime_mixed_otherr  z  sE    ,(9:7KKKFlL9::H&(+++++r(   r   rG   r4  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'rk   r@  )r   rG   r`  )r   rG   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 1rk   r@  
01-01-2000r;  r   r`  rV   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-  )r|   r9   r   ri  rz   r@  r  r`   r-   c                 X    t          ddgd|           }t          j        ||           d S )Nr@  r  r;  r   r   )r|   r9   r8   s      r&   5test_to_datetime_mixed_not_necessarily_iso8601_coercer    s7     ,5iPVWWWF&(+++++r(   c                  ^   d} d}t          j        t          |          5  t          |           }d d d            n# 1 swxY w Y   |t          | d d                   k    sJ t          j        t                    5  t	          |           }d d d            n# 1 swxY w Y   |t	          | d d                   k    sJ t          j        t                    5  t	          | g          }d d d            n# 1 swxY w Y   t          j        |t	          | d d         g                     d S )Nz2014 Jan 9 05:15 FAKEzLun-recognized timezone "FAKE". Dropping unrecognized timezones is deprecatedrk   )r4   r   r   r   r   r5   )dtstrr   r'  s      r&   #test_ignoring_unknown_tz_deprecatedr    s   #E
XC		#M	=	=	=                )E#2#J''''''		#M	2	2 ! !%  ! ! ! ! ! ! ! ! ! ! ! ! ! ! !+eCRCj))))))		#M	2	2 # #5'""# # # # # # # # # # # # # # ##{E#2#J<8899999s3   <A A =BB BC77C;>C;c                     t          j        d           t          ddg|                                  d          }t	          |          }t          ddgd          }t          j        ||           d S )Nr  r   ri   z	[pyarrow]r-   r  )rn   r  r   lowerr   r4   ra   )any_numeric_ea_dtyperc   r8   r9   s       r&   test_from_numeric_arrow_dtyper    s|    
	"""
!Q"6"<"<">">III
J
J
JCFq!f$4555H68,,,,,r(   c                  *   ddg} t          | d          }t          t          d          dgd          }t          j        ||           t          |           }t          j        ||           t          |           }t          j        ||           d S )N2020-01-01 00:00+00:00r   r4  r   r   r  r-   )r   r   r   r4   r5   r   )r6  r8   r9   r  alt2s        r&   6test_to_datetime_with_empty_str_utc_false_format_mixedr    s    $b)Dg...Fi 8995AWWWH&(+++ d

C#x(((D$)))))r(   c                      d} t          j        t          |           5  t          g dd           d d d            d S # 1 swxY w Y   d S )Nr   rk   )r  z2020-01-01 00:00+02:00r   r4  r   r  )r   s    r&   Btest_to_datetime_with_empty_str_utc_false_offsets_and_format_mixedr    s    
GC		#M	=	=	= 
 
DDDW	
 	
 	
 	

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
r  c                     t          dd          } d}| |g}d}t          j        t          |          5  t	          |           d d d            n# 1 swxY w Y   t          j        t          |          5  t	          |d           d d d            n# 1 swxY w Y   t          j        t          |          5  t          |           d d d            d S # 1 swxY w Y   d S )	Nz2016-01-02 03:04:05r   r   z2023-10-30 15:06+01zsMixed timezones detected. pass utc=True in to_datetime or tz='UTC' in DatetimeIndex to convert to a common timezonerk   r4  r   )r   rn   ro   rp   r   r   )r  r  r7   r   s       r&   &test_to_datetime_mixed_tzs_mixed_typesr    s    
(\	:	:	:B!Eu+C	;  
z	-	-	-  C              	z	-	-	- ) )C(((() ) ) ) ) ) ) ) ) ) ) ) ) ) )	z	-	-	-  c                 s5   AAA7BBB;CCCc                     d} t          |           }|| g}t          |          }t          |d d d                   d d d         }t          |d          }t          |          }t          ||g          }t          j        ||           t          j        ||           t          j        ||           t          j        ||           d S )Nz2023-11-01 09:22:03-07:00r5  r4  r   r  )r  r  r7   r  r  res3res4r9   s           r&   )test_to_datetime_mixed_types_matching_tzsr    s    'E	5		Bu+CsDs44R4y!!$$B$'Ds7+++DDb"X&&H$)))$)))$)))$)))))r(   r  z)ignore:Could not infer format:UserWarning	aware_valc                 *    t          |           j        S rI  r&  r  rL  s    r&   rM  rM        $q''" r(   	naive_valic                 *    t          |           j        S rI  r  rL  s    r&   rM  rM     r  r(   naive_firstc                    | |dg}|}|r|| dg}t          | t                    ot          |t                    }t          |t          t          f          }d}t	          d |D                       }t          |t                    sd}	|rot          | t
                    rZt          |t
                    rd}	t          j        t          |	          5  t          |           d d d            n# 1 swxY w Y   nBt          j        t          |	          5  t          |           d d d            n# 1 swxY w Y   t          |d           nz|r|
                    |           |
                    |          k     rd	}	t          j        t          |	          5  t          |           d d d            n# 1 swxY w Y   t          j        t          |	          5  t          |d           d d d            n# 1 swxY w Y   n|r|
                    |           |
                    |          k     rd
}	t          j        t          |	          5  t          |           d d d            n# 1 swxY w Y   t          j        t          |	          5  t          |d           d d d            n# 1 swxY w Y   n
|r|
                    |          |
                    |           k     rd}	t          j        t          |	          5  t          |           d d d            n# 1 swxY w Y   t          j        t          |	          5  t          |d           d d d            n# 1 swxY w Y   nSt          j        t          |          5  t          |           d d d            n# 1 swxY w Y   t          |d           |rt          j        t          |          5  t          |d           d d d            n# 1 swxY w Y   t          j        t          |          5  d}	t          j        t          |	          5  t          |           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S d}	|rt          | t
                    rt          |t
                    rd}	t          j        t          |	          5  t          |d           d d d            n# 1 swxY w Y   t          j        t          |	          5  t          |           d d d            d S # 1 swxY w Y   d S t          j        t          |	          5  t          |d           d d d            n# 1 swxY w Y   t          j        t          |	          5  t          |           d d d            d S # 1 swxY w Y   d S )Nr   zFIn a future version of pandas, parsing datetimes with mixed time zonesc              3   &   K   | ]}|d k    |V  dS )r   NrV   rX   s     r&   r  z?test_to_datetime_mixed_awareness_mixed_types.<locals>.<genexpr>  s&      44AGG!GGGG44r(   z(Cannot mix tz-aware with tz-naive valuesz<Tz-aware datetime.datetime cannot be converted to datetime64rk   Tr  z!time data .* doesn't match formatz3time data \"2020-01-01 00:00\" doesn't match formatz1unconverted data remains when parsing with formatr4  r   z!DatetimeIndex has mixed timezones)r&  r`   r
  rf   nextr   rn   ro   rp   r   r  r4   r   r   r"  r   )
r  r  r  r6  vec	both_strshas_numericr  first_non_nullr   s
             r&   ,test_to_datetime_mixed_awareness_mixed_typesr    s	    y"%D
C ))R( 9c**Iz)S/I/IIYe55KWH44S44444N nc** )#8 	!:i;; 	!)Y// UTz555 ! !C   ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! z555 ! !C   ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! 	CT"""""	 #9--		)0D0DDD1]:S111 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	]:S111 	' 	'&&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 
 #syy++cii	.B.BBBD]:S111 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	]:S111 	' 	'&&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 
 #syy++cii	.B.BBBA]:S111 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	]:S111 	' 	'&&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 'XFFF 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	CT"""" #'XFFF 	- 	-G,,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-'XFFF 	# 	#5Cy444 # #c"""# # # # # # # # # # # # # # #	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	#
 9 	#:i;; 	#)Y// UTz555 1 1C00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1z555 # #c"""# # # # # # # # # # # # # # # # # # z555 1 1C00001 1 1 1 1 1 1 1 1 1 1 1 1 1 1z555 # #c"""# # # # # # # # # # # # # # # # # #s2  C,,C03C0D//D36D3F44F8;F8G88G<?G<I,,I03I0J00J47J4L$$L(+L(
M((M,/M,N++N/2N/$PP	P(Q:Q"Q:"Q&	&Q:)Q&	*Q::Q>Q>S00S47S4T33T7:T7U99U= U=V<<W W )l__doc__r   collectionsr   r   r   r   r   decimalr   r  dateutil.parserr
   dateutil.tz.tzr   numpyr0   rn   r  pandas._libsr   pandas._libs.tslibsr   r   pandas.compatr   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_testingr4   pandas.core.arraysr   pandas.core.toolsr   r  pandas.core.tools.datetimesr   r  r6  r;  r  r  
pytestmarkrH  r'   r*   r"  r  r  rJ  r  r  r/  r=  rv  ry  r{  r  r  r  r  r  r  r1   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rF  r  r   rf   r  rV   r(   r&   <module>r&     sU	                              ! ! ! ! ! ! # # # # # #                                  * ) ) ) ) ) ) ) ) < < < < < <    
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
       , , , , , , 0 0 0 0 0 0 8 8 8 8 8 8  	 IF	 
 FH [''8 

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