
    bMhb                         d Z ddlZddlZddlZddlmZmZmZm	Z	m
Z
mZmZ ddlmZ  G d d          Z G d d          Z G d d	          ZdS )
zx
test setting *parts* of objects both positionally and label based

TODO: these should be split among the indexer tests
    N)	DataFrameIndexPeriodSeries	Timestamp
date_rangeperiod_rangec                   b    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd ZdS )TestEmptyFrameSetitemExpansionc                 P   t          i t          j        dd                    }t          dt          j        dd                    }||d<   t          ddgdz  it          j        dd          t	          dgt
          	          
          }t          j        ||           d S )Nr   df_indexnameindexGz?   series_indexseriesdtyper   columns)r   pd
RangeIndexr   r   objecttmassert_frame_equalselfdfr   expecteds       b/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pandas/tests/indexing/test_partial.py,test_empty_frame_setitem_index_name_retainedzKTestEmptyFrameSetitemExpansion.test_empty_frame_setitem_index_name_retained   s    rqz!B!B!BCCCBM!.$I$I$IJJJ8vz"-
3338*F333
 
 
 	b(+++++    c                 "   t                      }t          dt          j        dd                    }||d<   t          ddgdz  it          j        dd          t	          dgt
                              }t          j        ||           d S )	Nr   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   s       r#   -test_empty_frame_setitem_index_name_inheritedzLTestEmptyFrameSetitemExpansion.test_empty_frame_setitem_index_name_inherited&   s    [[BM!.$I$I$IJJJ8vz"-7778*F333
 
 

 	b(+++++r%   c                    t          ddg          }t          dt          d                    |j        d<   t          ddgdgt          j                  }t          j        ||           t          ddg          }t          ddg          |j        d<   t          t          j        dggddgdgd	          }t          j        ||           d S )
NABr      r   r   r   )r   r   r   float64)	r   r   rangelocnpr-   r   r   nan)r    r!   r"   exps       r#   -test_loc_setitem_zerolen_series_columns_alignzLTestEmptyFrameSetitemExpansion.test_loc_setitem_zerolen_series_columns_align2   s    Sz***1E!HH---q	c3Zs"*MMM
b(+++ Sz***1SE***q	"&!Sz!IVVV
b#&&&&&r%   c                 X   t          ddg          }d}t          j        t          |          5  g d|j        d<   d d d            n# 1 swxY w Y   t          ddg          }dd	g|j        d
<   t          dd	ggd
gddgt
          j                  }t          j        ||           d S )Nr)   r*   r+   z(cannot set a row with mismatched columnsmatchr,         r         r9   )r   r   r   )	r   pytestraises
ValueErrorr/   r0   int64r   r   )r    r!   msgr2   s       r#   7test_loc_setitem_zerolen_list_length_must_match_columnszVTestEmptyFrameSetitemExpansion.test_loc_setitem_zerolen_list_length_must_match_columns@   s    Sz***8]:S111 	" 	"!		BF1I	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" Sz***Fq	!Qc3ZrxPPP
b#&&&&&s   A		AAc                    t                      }d}t          j        t          |          5  d|j        d<   d d d            n# 1 swxY w Y   t          j        t          |          5  t          dgdg          |j        d<   d d d            n# 1 swxY w Y   d}t          j        t          |          5  d|j        d d df<   d d d            d S # 1 swxY w Y   d S )Nz*cannot set a frame with no defined columnsr5   r,   foor   z5cannot set a frame with no defined index and a scalar)r   r<   r=   r>   r/   r   )r    r!   r@   s      r#   test_partial_set_empty_framez;TestEmptyFrameSetitemExpansion.test_partial_set_empty_frameN   s    [[:]:S111 	 	BF1I	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ]:S111 	3 	3s5'222BF1I	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 F]:S111 	 	BF111a4L	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s5   AA
A)BBB9CCCc                 
   t          t          dgt                    t          g d                    }t          t          g d                    }t          g d          |d<   t	          j        ||           t          t          g                     }t          |j                  |d<   t	          j        ||           t          t          g                     }|j        |d<   t	          j        ||           d S )NrC   r   r   r   r   r   )r   r   r   r   r   r   r   r    r"   r!   s      r#   test_partial_set_empty_frame2z<TestEmptyFrameSetitemExpansion.test_partial_set_empty_frame2_   s     5'000b8Q8Q8Q
 
 
 U2X6667772X...5	
b(+++U2YY'''28$$5	
b(+++U2YY'''H5	
b(+++++r%   c                    t          t          dgt                    t          g d                    }|d                             d          |d<   t          t          g d                    }g |d<   t	          j        ||           t          t          g d                    }t          t          j        t          |                    d          |d<   t	          j        ||           d S )NrC   r   r?   rF   r-   r   )
r   r   r   astyper   r   r   r0   arangelenrG   s      r#   test_partial_set_empty_frame3z<TestEmptyFrameSetitemExpansion.test_partial_set_empty_frame3v   s    5'000b8P8P8P
 
 
 #5/00;;U2W5556665	
b(+++U2W55566629SWW--Y???5	
b(+++++r%   c                 R   t          t          g d                    }t          t          |                    |d<   t          t          dgt                    t          g d                    }|d                             d          |d<   t          j        ||           d S )Nr?   r   r   rC   rF   )r   r   r.   rL   r   rJ   r   r   r    r!   r"   s      r#   test_partial_set_empty_frame4z<TestEmptyFrameSetitemExpansion.test_partial_set_empty_frame4   s    U2W555666#b''NN5	5'000b8P8P8P
 
 
 #5/0099
b(+++++r%   c                 |   t                      }t          j        |j        t	          j        d                     t                      }t          dgdg          |d<   t          dgdg          |j        d d df<   t          j        |t          dggdgdg                     t          j        ||           d S )Nr   r,   rC   r   r   )	r   r   assert_index_equalr   r   r   r   r/   r   )r    r!   df2s      r#   test_partial_set_empty_frame5z<TestEmptyFrameSetitemExpansion.test_partial_set_empty_frame5   s    [[
bj"-*:*:;;;kkE7+++Aqc%111qqq!t
b)aSE%1#"N"N"NOOO
b#&&&&&r%   c           	         t          dt          dt          d                    ig d          }t          ddg          }t          dt          d                    |d<   t          j        ||           t          ddg          }t          dt          d                    |j        d d df<   t          j        ||           d S )	Nr   r,   r   r   )r)   r*   r   r+   r)   r*   )r   r   r.   r   r   r/   rG   s      r#   %test_partial_set_empty_frame_no_indexzDTestEmptyFrameSetitemExpansion.test_partial_set_empty_frame_no_index   s    aq!:!:!:;]]]SSSSz***qa)))1
b(+++Sz***auQxx000qqq!t
b(+++++r%   c                 *   t          g dt          g d                    }|d                             d          |d<   |d                             d          |d<   |d                             d          |d<   t          g d	g d
d          }||j        dk             }t          j        |d<   t          j        ||           t          g d          }|d                             d          |d<   t          g d          }d|d<   t          j        ||           t          j        |d         t          dt                               t          g d	g d
d          }||j        dk             }|                    g d          }t          g d          }|d                             d          |d<   |d                             d          |d<   |d                             d          |d<   t          j        ||           d S )N)r)   r*   Newr?   r   rF   r)   r*   r-   rX   r7   )g333333?g@g@r)   r*      )abc cdr+   r^   )r[   r\   r]   r9   r]   r   r   )r)   r*   Cr`   )r   r   rJ   r)   r0   r1   r   r   assert_series_equalr   r   reindex)r    r"   r!   yresults        r#    test_partial_set_empty_frame_rowz?TestEmptyFrameSetitemExpansion.test_partial_set_empty_frame_row   s    %6%6%6eBg>V>V>VWWW ,,W55 ,,Y77"5/00;;YYY___==>>rtaxL6%
a***%;%;%;<<< ,,W550001113
b(+++
r%y&e6*J*J*JKKK YYY___==>>rtaxL???33___555 ,,W55 ,,Y77 ,,Y77
fh/////r%   c                 t   t          t          t                              }t          dt          t                    i          }t          j        ||           t          t          dt                              }t          dt          t                    i          }t          j        ||           d S )Nr   r   rC   r_   )r   r   r   r   r   rO   s      r#   'test_partial_set_empty_frame_set_serieszFTestEmptyFrameSetitemExpansion.test_partial_set_empty_frame_set_series   s     vF+++,,af!5!5!5677
b(+++v577788eV&%9%9%9:;;
b(+++++r%   c                     t          dg          }|                                }d|d<   t          ddgt          dgt                              }t	          j        ||           d S )Nr   r   r[   r   r   )r   copyr   r   r   r   rO   s      r#   2test_partial_set_empty_frame_empty_copy_assignmentzQTestEmptyFrameSetitemExpansion.test_partial_set_empty_frame_empty_copy_assignment   sj     aS!!!WWYY3Qqc5#f3M3M3MNNN
b(+++++r%   c                 d   t          ddg          }ddg|d<   t          ddgt          j        t          j        gd          }t          j        ||d           t          ddg          }d	d
g|d<   t          t          d	d
g|st          nd          t          t          j        t          j        gt                    d          }t          j        ||           t          ddg          }d|j        d<   t          dgt          j        gd          }t          j        ||d           d S )Nxrc   r+   r,   r8   )rl   rc   F)check_dtype12strr   )r   rl   )r   r0   r1   r   r   r   r   r/   )r    using_infer_stringr!   r"   s       r#   0test_partial_set_empty_frame_empty_consistencieszOTestEmptyFrameSetitemExpansion.test_partial_set_empty_frame_empty_consistencies   sF    Sz***a&3Aq60@AABB
b(>>>>Sz****3#J(:E&&   RVRV,F;;; 
 
 	b(+++Sz***vA3bfX6677
b(>>>>>>r%   N)__name__
__module____qualname__r$   r'   r3   rA   rD   rH   rM   rP   rT   rV   re   rg   rj   rr    r%   r#   r   r      s        , , ,
, 
, 
,' ' '' ' '  ", , ,., , , 	, 	, 	,' ' '
, 
, 
,0 0 0<	, 	, 	,, , ,? ? ? ? ?r%   r   c                      e Zd Zd Zej                            d          d             Zd Zd Z	d Z
d Zej                            dd	d
g          d             Zd Zej                            d eddd          g d edd           edd           edd          gf eddd          g d ed           ed           ed          gf ej        dd          g d ej        d           ej        d           ej        d          gfg          d             Zej                            d eddd          ddgf eddd          ddgf ej        dd          d d!gfg          d"             Zej                            d# eddd           ed$d%ge&          d'f eddd           ed$d%ge&          d'f ej        dd           eddge&          d(fg          d)             Zd*S )+TestPartialSettingc                 z   t          g d          }|                                }d|d<   t          g dg d          }t          j        ||           |                                }d|j        d<   t          g dg d          }t          j        ||           |                                }d|d<   t          g dg d          }t          j        ||           |                                }d|j        d<   t          g dg d          }t          j        ||           |                                }d}t          j        t          |	          5  d|j        d
<   d d d            n# 1 swxY w Y   d}t          j        t          |	          5  d|j	        d
<   d d d            d S # 1 swxY w Y   d S )Nr7   rZ   )r,   r8   r9   rZ   )r   r,   r8   rZ   r         @)r,   r8   r9   rz   %iloc cannot enlarge its target objectr5   r9   z/index 3 is out of bounds for axis 0 with size 3)
r   ri   r   ra   r/   r<   r=   
IndexErrorilociat)r    s_origsr"   r@   s        r#   test_partial_settingz'TestPartialSetting.test_partial_setting   s:    			""KKMM!,,,lll;;;
q(+++KKMMa,,,lll;;;
q(+++KKMM!...===
q(+++KKMMa...===
q(+++ KKMM5]:S111 	 	AF1I	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 @]:S111 	 	AE!H	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s$   E00E47E4F00F47F4z.ignore:Setting a value on a view:FutureWarningc                    t          t          j        d                              dd          ddgd          }|                                }d}t          j        t          |	          5  d
|j        d<   d d d            n# 1 swxY w Y   d}|rd}t          j        t          |	          5  d
|j	        d<   d d d            n# 1 swxY w Y   t          g dg dd          }|                                }|j        d         |j        d<   t          j        ||           t          g dg dd          }|                                }|j        d         |j        d<   t          j        ||           t          g dg dd          }|                                }|j        d         |j        d<   t          j        ||           t          g dg dd          }|                                }|j        d d df         |j        d d df<   t          j        ||           t          g dt          g d          d          }|                                }|d                             t          j                  |d<   |j        d d df         |j        d d df<   t          j        ||           |                                }|d         |d<   |                                }|j        d d df         |j        d d df<   t          j        ||           |                                }|d         |d<   |                                }|j        d d df         |j        d d df<   t          j        ||           d S )Nr:   r9   r8   r)   r*   r?   )r   r   r{   r5   rz   )r   r8   z/index 2 is out of bounds for axis 0 with size 2zlist index out of range)r   r   r   )r,   rZ   rZ   rY   r,   )r   r8   r   r   )r,   r9   rZ   rZ   )r   r8   r   )g        g       @g      @r`   )r   r0   rK   reshaperi   r<   r=   r|   r}   r~   r   r   r/   r   rJ   r-   )r    using_array_managerdf_origr!   r@   r"   s         r#   test_partial_setting_framez-TestPartialSetting.test_partial_setting_frame  s   IaLL  A&&c
'
 
 

 \\^^5]:S111 	  	 BGDM	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  @ 	,+C]:S111 	 	BF4L	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 999999==>>\\^^WQZ

b(+++999999==>>\\^^F1Iq	
b(+++ <<<lllCCDD\\^^F1Iq	
b(+++ 999999==>>\\^^3qqq#v
b(+++ 9996///3J3JKKLL\\^^S'..,,3 3qqq#v
b(+++ <<>>3\\^^3qqq#v
b(+++ <<>>3\\^^3qqq#v
b(+++++s$   ,BB
B/CC
C
c           	         t          dd          }t          t          j                            d                              d          |g d          }t          j        |t          dd	i|d
d          |j        z             gd          }|	                                }d	|j
        |d
         |j        z   df<   t          j        ||           |	                                }d	|j        |d
         |j        z   df<   t          j        ||           t          dd	i|d
d          |j        z             }t          j        ||gd          }|	                                }d	|j
        |d
         |j        z   df<   t          j        ||           |	                                }d	|j        |d
         |j        z   df<   t          j        ||           d S )Nz1/1/2000   )periodsr8   )r   r   )r)   r*   r`   Dr   r)   r;   r   T)sortr   r,   axis)r   r   r0   randomdefault_rngstandard_normalr   concatfreqri   r/   r   r   at)r    datesr   r"   r!   	exp_others         r#   test_partial_setting2z(TestPartialSetting.test_partial_setting2Z  s   :q111I!!!$$44V<<(((
 
 
 9iabcc
UZ0GHHHIPT
 
 
 \\^^./uRy5:%s*+
b(+++\\^^-.eBi%*$c)*
b(+++q!fE"##J,CDDD	9gy1:::\\^^,-uRy5:%q()
b(+++\\^^+,eBi%*$a'(
b(+++++r%   c                 L   t          ddgddggddg          }|j        d                                         }d|_        t	          j        |t          |          j                                        g          }|j        d         |j        d<   t          j	        ||           d S )NTr,   Fr8   femalefitnessr+   )
r   r/   ri   r   r   r   Tinfer_objectsr   r   )r    r!   r   r"   s       r#    test_partial_setting_mixed_dtypez3TestPartialSetting.test_partial_setting_mixed_dtypew  s     q	E1:.98MNNNF1INN9b)A,,.">">"@"@ABBF1Iq	
b(+++++r%   c                 H   t          ddgddg          }t          t          j        dt          j        gg d          }t          j        t
          d          5  |j        g d          d d d            n# 1 swxY w Y   |                    g d          }t          j	        ||d	
           t          t          j        dt          j        t          j        gg d          }t          j        t
          d          5  |j        g d          d d d            n# 1 swxY w Y   |                    g d          }t          j	        ||d	
           t          g dg d          }|j        g d         }t          j	        ||d	
           t          ddt          j        dgg d          }t          j        t
          d          5  |j        g d          d d d            n# 1 swxY w Y   |                    g d          }t          j	        ||d	
           dt          j
        t                     d}t          j        t
          |          5  |j        g d          d d d            n# 1 swxY w Y   t          ddt          j        gg d          }t          j        t
          d          5  |j        g d          d d d            n# 1 swxY w Y   |                    g d          }t          j	        ||d	
           t          g dg d          }t          dt          j        t          j        gg d          }t          j        t
          d          5  |j        g d          d d d            n# 1 swxY w Y   |                    g d          }t          j	        ||d	
           t          g dg d          }t          t          j        ddgg d          }t          j        t
          d          5  |j        g d          d d d            n# 1 swxY w Y   |                    g d          }t          j	        ||d	
           t          g dg d          }t          t          j        ddgg d          }t          j        t
          d          5  |j        g d          d d d            n# 1 swxY w Y   |                    g d          }t          j	        ||d	
           t          g dg d          }t          dt          j        t          j        gg d          }t          j        t
          d          5  |j        g d          d d d            n# 1 swxY w Y   |                    g d          }t          j	        ||d	
           t          g dg d          }t          dt          j        t          j        gg d          }t          j        t
          d          5  |j        g d          d d d            n# 1 swxY w Y   |                    g d          }t          j	        ||d	
           t          g dg d           }|j        g d!         }t          j	        ||d	
           d S )"N皙?皙?r,   r8   r   r9   r8   r9   not in indexr5   Tcheck_index_typer9   r8   r9   rl   r   r   r   r8   r8   r,   r8   r8   rl   r,   '\"None of \[Index\(\[3, 3, 3\], dtype='z'\)\] are in the \[index\]\"r9   r9   r9   r8   r8   r9   r   r   333333?r7   r   r9   r   r   r   r   r   皙?r,   r8   r9   r   rZ   r9   r9   r   rZ   r   r   r   rZ   r:   r;   r;   r8   r8   r   rZ   rZ   r   r   r   r   r8   r8   r,   r,   r,   r,   r   r   )r   r0   r1   r<   r=   KeyErrorr/   rb   r   ra   r   intr}   )r    serr"   rd   r@   r   s         r#   test_series_partial_setz*TestPartialSetting.test_series_partial_set  s 	    c3Z1v... 263/yyyAAA]8?;;; 	 	GIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 YYY''
vx$GGGG2637~~~NNN]8>::: 	$ 	$GNNN##	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ ^^^,,
vx$GGGG///;;;#
vx$GGGG3RVS1HHH]8>::: 	$ 	$GNNN##	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ ^^^,,
vx$GGGG&rx}} & & & 	 ]83/// 	 	GIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 3RV,III>>>]8>::: 	 	GIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 YYY''
vx$GGGG???)))4443/yyyAAA]8>::: 	 	E)))	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 999%%
vx$GGGG'''|||<<<263,III>>>]8>::: 	 	E)))	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 999%%
vx$GGGG'''|||<<<263,III>>>]8>::: 	 	E)))	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 999%%
vx$GGGG'''|||<<<3/yyyAAA]8>::: 	 	E)))	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 999%%
vx$GGGG'''|||<<<3/yyyAAA]8>::: 	 	E)))	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 999%%
vx$GGGG ...lllCCC,,,'
vx$GGGGGGs   A77A;>A; DD #D G((G,/G,I55I9<I9;KKK*NN
N
P++P/2P/4SSS#U??VVX..X25X2c                 l   t          ddgdd          }t          ddg|d	          }t          j        t          d
          5  |j        g d          d d d            n# 1 swxY w Y   t          j        t          d          5  |j        g d          d d d            n# 1 swxY w Y   t          g ddd          }t          g d|d	          }|j        g d         }t          j        ||d           t          j        t          d          5  |j        g d          d d d            n# 1 swxY w Y   dt          j	        t                     d}t          j        t          |          5  |j        g d          d d d            n# 1 swxY w Y   t          j        t          d          5  |j        g d          d d d            n# 1 swxY w Y   t          g ddd          }t          j        t          d          5  t          g d|d	          j        g d          d d d            n# 1 swxY w Y   t          g ddd          }t          j        t          d          5  t          g d|d	          j        g d          d d d            n# 1 swxY w Y   t          g ddd          }t          j        t          d          5  t          g d|d	          j        g d          d d d            n# 1 swxY w Y   t          g d dd          }t          j        t          d          5  t          g d|d	          j        g d!          d d d            n# 1 swxY w Y   t          g ddd          }t          j        t          d          5  t          g d|d	          j        g d"          d d d            n# 1 swxY w Y   t          g d#dd          }t          g d$|d	          }|j        g d%         }t          j        ||d           d S )&Nr,   r8   r?   idxr   r   r   r   r   )r   r   z\[3\] not in indexr5   r   r   r   r   r   Tr   z\['x'\] not in indexr   r   z(', name='idx'\)\] are in the \[index\]\"r   r   r7   r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r<   r=   r   r/   r   ra   r0   r   r   r}   )r    r   r   exp_idxr"   rd   r@   s          r#   !test_series_partial_set_with_namez4TestPartialSetting.test_series_partial_set_with_name  s3    QF'666c3Zs555 ]8+@AAA 	 	GIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ]8?;;; 	$ 	$GNNN##	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 			u===///sCCC#
vx$GGGG]8+BCCC 	$ 	$GNNN##	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$
5rx}} 5 5 5 	 ]83/// 	 	GIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ]8>::: 	 	GIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 IIIW5999]8>::: 	H 	H???#C888<YYYGG	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H 	H LLLe<<<]8>::: 	M 	M'''s===A)))LL	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M LLLe<<<]8>::: 	M 	M'''s===A)))LL	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M LLLe<<<]8>::: 	M 	M'''s===A)))LL	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M LLLe<<<]8>::: 	M 	M'''s===A)))LL	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M G%@@@...gCHHH,,,'
vx$GGGGGGs   A  A$'A$B""B&)B&D22D69D65FFF7GGG"H;;H?H?5"J##J'*J'"LLL"M33M7:M7-"OO"Okeyd   g      Y@c           	      h   t          t          j                            d                              d          t          t          d          t                    t          ddd          	          }|	                                }|j
        d
         |j        |d d f<   t          t          |j                  |gz   t          |j        j                  }t          j        |j        |j
        d
g         j        gd
          }t          |||j                  }t#          j        ||           d S )Nr8   
   r   ABCDr   
2000-01-01r   r*   r   r   rF   r   r   r   r   )r   r0   r   r   r   r   listr   r   ri   r}   r/   r   r   concatenatevaluesr   r   r   )r    r   origr!   ex_indexex_datar"   s          r#   6test_setitem_with_expansion_numeric_into_datetimeindexzITestPartialSetting.test_setitem_with_expansion_numeric_into_datetimeindex  s    I!!!$$44W==$v,,f555\2C@@@
 
 

 YY[[sAAAvdj))SE1djoVVV.$+rws|/B!C!LLLWHdlKKK
b(+++++r%   c           	         t          t          j                            d                              d          t          t          d          t                    t          ddd          	          }|	                                }|j
        d
         |j        dd d f<   t          |j
        d
         d          }t          j        |t          |          j                                        g          }t#          j        ||           t#          j        |j        t          |j                                        dgz                        |j        j        dk    sJ d S )Nr8   r   r   r   r   r   r*   r   rF   r   r[   r   r   )r   r0   r   r   r   r   r   r   r   ri   r}   r/   r   r   r   r   r   r   r   rR   r   tolistr   )r    r   r!   r   r2   s        r#   test_partial_set_invalidz+TestPartialSetting.test_partial_set_invalid)  s*    I!!!$$44W==$v,,f555\2C@@@
 
 
 YY[[sAAAvRWQZc***iy~~/==??@AA
b#&&&
bhdj.?.?.A.ASE.I(J(JKKKx~))))))r%   zidx,labels,expected_idx2000   r   )startr   r   )
2000-01-04
2000-01-08
2000-01-12r   )r   r   r   z1 day)r   r   )4D8D12Dz4 dayz8 dayz12 dayc                      |t          d          |          }g d} |||          }t          j        ||j        |                    |t          u rt          j        |||                    d S d S )Nr   r   )r9   r;      )r.   r   assert_equalr/   r   ra   )r    r   labelsexpected_idxframe_or_seriesobjexpected_valuer"   s           r#   4test_loc_with_list_of_strings_representing_datetimeszGTestPartialSetting.test_loc_with_list_of_strings_representing_datetimes<  s    @ oeBiis333#"?><@@
#'&/222f$$"8S[99999 %$r%   z
idx,labelsz
2000-01-30z3 dayz30 dayc                    t          t          d          |          }t          t          d          |          }d}t          j        t
          |          5  |j        |          d d d            n# 1 swxY w Y   t          j        t
          |          5  ||          d d d            n# 1 swxY w Y   t          j        t
          |          5  |j        |          d d d            d S # 1 swxY w Y   d S )Nr   r   r   r5   r   r.   r   r<   r=   r   r/   )r    r   r   r   r!   r@   s         r#   Btest_loc_with_list_of_strings_representing_datetimes_missing_valuezUTestPartialSetting.test_loc_with_list_of_strings_representing_datetimes_missing_valuee  s   $ U2YYc***uRyy,,,]83/// 	 	GFOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	]83/// 	 	KK	 	 	 	 	 	 	 	 	 	 	 	 	 	 	]83/// 	 	F6NN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s6   A44A8;A8	B//B36B3C00C47C4zidx,labels,msgr   r   r   zHNone of \[Index\(\['4D', '8D'\], dtype='object'\)\] are in the \[index\]zXNone of \[Index\(\['2000-01-04', '2000-01-08'\], dtype='object'\)\] are in the \[index\]c                    t          t          d          |          }t          t          d          |          }t          j        t
          |          5  |j        |          d d d            n# 1 swxY w Y   t          j        t
          |          5  ||          d d d            n# 1 swxY w Y   t          j        t
          |          5  |j        |          d d d            d S # 1 swxY w Y   d S )Nr   r   r5   r   )r    r   r   r@   r   r!   s         r#   Etest_loc_with_list_of_strings_representing_datetimes_not_matched_typezXTestPartialSetting.test_loc_with_list_of_strings_representing_datetimes_not_matched_type  s   B U2YYc***uRyy,,,]83/// 	 	GFOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	]83/// 	 	KK	 	 	 	 	 	 	 	 	 	 	 	 	 	 	]83/// 	 	F6NN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s6   A22A69A6	B--B14B1C..C25C2N)rs   rt   ru   r   r<   markfilterwarningsr   r   r   r   r   parametrizer   r   r	   r   r   r   r   timedelta_range	Timedeltar   r   r   r   r   rv   r%   r#   rx   rx      s       # # #J [ PQQ>, >, RQ>,@, , ,:
, 
, 
,YH YH YHv8H 8H 8Ht [US%L11, , 21, * * *& [! 62C@@@:::F<c222F<c222F<c222 
#>>>:::Il++Il++Il++ #""===###g&&W(=(=|r|H?U?UV'	
 8: :9 8: [ 62C@@@|,
 
#>>>|,  Rgr:::Wh<OP
	
    [ 62C@@@tTl&111,	 
#>>>tTl&111,	 #""===|\2&AAA?	#	
 : ; :  r%   rx   c                       e Zd Zd ZdS )TestStringSlicingc           	         t          j        g d          }t          t          t	          |                    |          }t          t          t	          |d d                             |d d                   }t          j        t          d          5  |dd          d d d            n# 1 swxY w Y   |dd         }t          j	        ||           d S )	N)
2012-01-01z
2012-01-02z
2012-01-03Nr   r9   z non-existing keys is not allowedr5   r   z
2012-01-04z2012-01-03 00:00:00.000000000)
r   to_datetimer   r.   rL   r<   r=   r   r   r   )r    r   r!   r"   rd   s        r#   ,test_slice_irregular_datetime_index_with_nanz>TestStringSlicing.test_slice_irregular_datetime_index_with_nan  s   OOOPPuSZZ((666U3uRaRy>>22%)DDD]8+MNNN 	* 	* |L())		* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* L!@@A
fh/////s   B//B36B3N)rs   rt   ru   r   rv   r%   r#   r   r     s#        0 0 0 0 0r%   r   )__doc__numpyr0   r<   pandasr   r   r   r   r   r   r   r	   pandas._testing_testingr   r   rx   r   rv   r%   r#   <module>r      s4                                   Y? Y? Y? Y? Y? Y? Y? Y?xx x x x x x x xv0 0 0 0 0 0 0 0 0 0r%   