
    Owg7                         d dl m Z  d dlZd dlZd dlZd dlZd dlmZmZ d dl	m
Z d Zd Zd Zd Zej                   j#                  dd	d
g      d        Zd Zd Zd Zd Zd Zy)    )datetimeN)Index
MultiIndexc                 Z   | j                  dd      }|j                  |       sJ |d   dk(  sJ | j                  dd      }t        t        | j                  d         dgz   d      }t        j                  |j                  d   |       |j                  ddgk(  sJ t        t        | j                  d         d	gz   d      }t        j                  |j                  d   |       |d   dk(  sJ d
}t        j                  t        |      5  | j                  dd       d d d        t        j                  g dg dgg d      }|j                  ddgd       |d   j                  d      }d|j                  d<   d|j                  d<   d|j                  d<   d|j                  d<   d|j                  d <   d!|j                  d"<   d|j                  d#<   d|j                  d$<   d|j                  d%<   d|j                  d&<   d|j                  d'<   d!|j                  d(<   t        j                  g dg dg d)g d*g d+g d,g d-g d.gg d      }|j                  ddgd       t        j                   ||d/0       t        j"                  ||d          y # 1 sw Y   xY w)1Nr   )bartwo)abcthreer	   first)namesecond   r
   z/Item must have length equal to number of levelsmatch)foo2)abr   )r   dr   )1st2nd3rd)columnsr   r   T)inplacer   )deep   )r   xr   )r   r   r      )r   r   r      )r   r   r      )r   wr      )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'   F)check_dtype)insertequal_levelsr   listlevelstmassert_index_equalnamespytestraises
ValueErrorpd	DataFrame	set_indexcopylocassert_frame_equalassert_series_equal)idx	new_indexexp0exp1msglefttsrights           ^/var/www/horilla/myenv/lib/python3.12/site-packages/pandas/tests/indexes/multi/test_reshape.pytest_insertrD      s   

1n-I!!#&&&Q<>))) 

1./Icjjm$w.W=D)**1-t4??w1111cjjm$y0x@D)**1-t4Q<++++ <C	z	- !

1i ! <<6@UVDNNE5>4N0	e		t		$B"#DHH"$DHH"#DHH"#DHH"#DHH"#DHHBFF:BFF8BFF:BFF8BFF:BFF8LL		
 &E 
OOUENDO1 $592uU|,M! !s   J  J*c                     t        d      D  cg c]  } d| f c} t        d      D  cg c]  } d| f c} z   ddgz   }t        j                  t        j                  ddd	      t        j                  |d d
             }d	|j                  d<   d|j                  d<   t        j                  t        j                  ddd      t        j                  |            }t        j                  ||       y c c} w c c} w )Nr$   test1r'   test2)test   )rH      r   
            )
ranger4   Seriesnplinspacer   from_tuplesr8   r.   r:   )ir;   r@   rB   s       rC   test_insert2rV   K   s      %Qx(!'1(!&q
*AGQ<
*	+
&	'  99R[[B+Z-C-CCH-MNDDHH\DHH\IIbkk!R,j.D.DS.IJE4' 	)
*s
   C1C6c                    | d d j                  | dd        }|j                  |       sJ | d d | dd | dd  g}|d   j                  |dd        }|j                  |       sJ | j                  g       }|j                  |       sJ y )Nr    r   r   )appendequals)r;   resultfooss      rC   test_appendr\   ]   s    !W^^CG$F==GS1Xs12w'D!W^^DH%F== ZZ^F==    c                     t        g d      } t        j                  dddd      }t        g d      }t        j                  | |g      }t        j                  | ||g      }| j                  |      }t        j                  d      }d|j                  t        d	d
d
            fd|j                  t        d	d
d            fd|j                  t        d	d
d            fg}t        g d|z         }t        j                  ||       |j                  |       }t        |g dz         }t        j                  ||       |j                  |      }t        j                  | j                  |       |j                  |      g      }t        j                  ||       |j                  |      }t        j                  ||       |j                  |      }t        j                  t        j                  d|j                  t        d	d
d
            dfd|j                  t        d	d
d            dfd|j                  t        d	d
d            dfg|z   t              d       }t        j                  ||       y )N)皙?333333??z
2011-01-01Dr    z
Asia/Tokyo)freqperiodstz)ABCr_   i  r   r`   r   ra   rf   rg   rh   )dtype)r   r4   
date_ranger   from_arraysrX   pytztimezonelocalizer   r.   r/   _simple_newrR   arrayobject)	idx1idx2idx3midx_lv2midx_lv3rZ   re   expected_tuplesexpecteds	            rC   test_append_indexry   j   s"   !D==C|LD!D%%tTl3H%%tT4&89H[["F 
|	$B	bkk(4A./0	bkk(4A./0	bkk(4A./0O
 _67H&(+__T"F_67H&(+__X&F%%t{{4'8$++d:K&LMH&(+__X&F&(+__X&F  
bkk(4A"67=bkk(4A"67=bkk(4A"67=
  	
 	H &(+r]   z	name, expr!   )cNc                    t        j                  ddgddggddg      }t        j                  dgdggd| g      }|j                  |      }t        j                  g d	g d
gd|g      }t        j                  ||       y )Nr   r   r    r"   r   r   r0   r$   r   r   r    r    r"   r$   r   rk   rX   r.   r/   )r   expmidxmidx2rZ   rx   s         rC   test_append_names_matchr      s~     !!Aq6Aq6"23*ED""QC!:c4[AE[[F%%y)&<S#JOH&(+r]   c                     t        j                  ddgddggddg      } t        j                  dgdggd	d
g      }| j                  |      }t        j                  g dg dgd       }t        j                  ||       y )Nr   r   r    r"   r   r   r|   r$   r   yr}   r~   r   )r   r   rZ   rx   s       rC   test_append_names_dont_matchr      sx    !!Aq6Aq6"23*ED""QC!:c3Z@E[[F%%y)&<DIH&(+r]   c                     t         j                  j                  g d      } t         j                  j                  g d      }t        j                  | | g      }t        j                  ||g      }|j                  |      }t        j                  t        j                  dd      t        j                  dd      ft        j                  dd      t        j                  dd      ft        j                  dd      t        j                  dd      ft        j                  dd      t        j                  dd      ft        j                  dd      t        j                  dd      ft        j                  dd      t        j                  dd      ft        j                  dd      t        j                  dd      ft        j                  dd      t        j                  dd      fg      }t        j                  ||       y )	N)              ?       @)      ?      ?      @r   r   r   r   r   r   )
r4   IntervalIndexfrom_breaksr   from_productrX   rT   Intervalr.   r/   )ivl1ivl2mi1mi2rZ   rx   s         rC   'test_append_overlapping_interval_levelsr      sz   ''8D''8D

!
!4,
/C

!
!4,
/CZZ_F%%[[c"BKKS$9:[[c"BKKS$9:[[c"BKKS$9:[[c"BKKS$9:[[c"BKKS$9:[[c"BKKS$9:[[c"BKKS$9:[[c"BKKS$9:		
H &(+r]   c                  
   d} g d}t        j                  ddg      }t        j                  ||g|      }t        j                  ||j	                  |       g|      }t        j                  |j	                  |       |       y )Nr   r}   foor   r|   )rR   rp   r   r   repeatr.   r/   )repsnumbersr0   mrx   s        rC   test_repeatr      sm    DGHHeU^$E% 0>A&&d1C'DERH!((4.(3r]   c                 `    | dd }| dd j                  |j                  d| d               sJ y )Nr   r"   r   )rY   r*   )r;   rZ   s     rC   test_insert_baser      s6    1XF q8??6==CF3444r]   c                    | dd  }| j                  d      }|j                  |      sJ |j                  |j                  k(  sJ | d d }| j                  d      }|j                  |      sJ |j                  |j                  k(  sJ d}t        j                  t
        |      5  | j                  t        |              d d d        y # 1 sw Y   y xY w)Nr   r   r   z/index 6 is out of bounds for axis 0 with size 6r   )deleterY   r   r1   r2   
IndexErrorlen)r;   rx   rZ   r?   s       rC   test_delete_baser      s    12wHZZ]F==""";;(--'''3BxHZZ^F==""";;(--'''
;C	z	- 

3s8  s   &C

C)r   numpyrR   r1   rl   pandasr4   r   r   pandas._testing_testingr.   rD   rV   r\   ry   markparametrizer   r   r   r   r   r    r]   rC   <module>r      sx         9-x($
,,^ z;&?@, A,,,,45r]   