
    .i^                     Z   d 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	 ddl
mc mZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZ  ddl!m"Z" ddl#m$Z$  ejJ                  d	      Z& G d
 d      Z' G d d      Z( G d d      Z) G d d      Z* G d d      Z+ G d d      Z,y)z(test positional based indexing with iloc    )datetimeN)pa_version_under16p0)IndexingError)NACategoricalCategoricalDtype	DataFrameIndexIntervalNaTSeries	Timestamparrayconcat
date_rangeinterval_rangeisnato_datetime)	is_scalar)"check_indexing_smoketest_or_raiseszuonly integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indicesc                   "   e Zd Zej                  j                  dddg dg      ej                  j                  d e ed      e       eg de       e	d	d
       e e
ddd      ej                         eg       g      d               Zy)TestiLockey   r      r   indexabcddtype)r      null   20130101r"   periodsr   r$   c                 b     |t        t        |            |      }t        |d|t               y )Nr   iloc)fails)rangelenr   
IndexError)selfr   frame_or_seriesr   requestobjs         ]/var/www/app/trading-bot/venv/lib/python3.12/site-packages/pandas/tests/indexing/test_iloc.py"test_iloc_getitem_int_and_list_intz+TestiLoc.test_iloc_getitem_int_and_list_int*   s-     eCJ/u=*		
    N)__name__
__module____qualname__pytestmarkparametrizer
   listobjectr   r,   npfloat64r4    r5   r3   r   r   )   s    [[UQI$67[[$v,f-#62z1-%1a.

3"I	
	
	 8
r5   r   c                   	   e Zd ZdZej
                  j                  d ed       ed       ed      g d e	 ed             e
j                  g d      g      d        Zej
                  j                  ddd	g      d
        Zd Zej
                  j                  ed      d        Zej
                  j                  d e
j$                  d       ed      fg      ej
                  j                  d ed      ddggddg ed      f eddd      g ed      fg      d               Zd Zd Zd Zd Zd Zd Zej
                  j                  d dd	gg d!g      d"        Zd# Zd$ Zej
                  j                  ddd	g      d%        Zej
                  j                  ddd	g      d&        Z ej
                  j                  ddd	g      d'        Z!d( Z"d) Z#d* Z$d+ Z%d, Z&d- Z'ej
                  j                  ddd	g      d.        Z(ej
                  j                  ddd	g      d/        Z)ej
                  j                  ddd	g      ej
                  j                  d0d1g eddd       e
jT                  d1g      g      ej
                  j                  d2d3g e
jT                  d3g      g      d4                      Z+ej
                  jY                  d5      d6        Z-d7 Z.d8 Z/d9 Z0d: Z1d; Z2d< Z3d= Z4d> Z5d? Z6d@ Z7dA Z8dB Z9dC Z:ej
                  j                  d2de;e
jx                  g      dD        Z=ej
                  j                  dE e>d1d      dFdGg      dH        Z?dI Z@dJ ZAdK ZBdL ZCej
                  j                  dMee
jT                  g      dN        ZDej
                  j                  ddd	g      ej
                  j                  d0dg eddO      g      dP               ZEej
                  j                  ddd	g      dQ        ZFdR ZGdS ZHdT ZIdU ZJdV ZKej
                  j                  dWee
jT                  g      ej
                  j                  dXee
jT                  g      dY               ZLdZ ZMd[ ZNd\ ZOd] ZPy)^TestiLocBaseIndependentzTests Independent Of Base Classr   N   r   c                     t        dt        d      it              }t        g d      }|j                  j
                  d   j                  |      sJ |j                         }|j                  }| ||      |df<   t        d|i      j                  t              }t        j                  |d   j                  |      sJ t        j                  ||       d|j                  d<   |d   dk7  sJ t        t        j                  g dt              t        d      d      }|j                         }| ||      |df<   t        t!        |j                  t              t              t        d      d      }t        j                  ||       y )	Nr   rC   r    )alphabetagammarG   r   r   r   r   r   )r	   r,   r=   r   _mgrblocks_can_hold_elementcopyvaluesastyper>   shares_memorytmassert_frame_equalr*   r   r   )r/   
indexer_lir   framecatdf	orig_valsexpecteds           r3   %test_iloc_setitem_fullcol_categoricalz=TestiLocBaseIndependent.test_iloc_setitem_fullcol_categoricalE   sE    1eAh-v645zz  #55c:::ZZ\II	!$
2sAvaX&--f51i888
b(+  1v   
 bhhy?E!HMNZZ\!$
2sAv

6(:&!IeTUhWX
b(+r5   has_refTFc                 t   t        g d      } ||j                  d            }|r|d d  }|t        u r|j                  }n#|j                  j
                  d   j                  }|t        u r ||dd        |j                  d d n ||dd        |j                  d ddf<    |t        j                   g dd            }t        j                  ||       |sa|t        u r3|j                  |usJ t        j                  |j                  |      sJ y t        j                  |d   j                  |      sJ y y )Nr   r   rC   r"   i8r   r   )rC   r"   rC   r"   r    )r   to_numpyr   rN   rJ   rK   r*   r>   rQ   assert_equalrP   )	r/   r0   index_or_series_or_arrayrZ   arrr2   viewrN   rX   s	            r3   test_iloc_setitem_ea_inplacez4TestiLocBaseIndependent.test_iloc_setitem_ea_inplacen   s    L!cll401q6Df$ZZFXX__Q'..Ff$3CG<CHHRaL6s12w?CHHRaRUO"288L#EF
X& &(zz///''

F;;;''Av>>> r5   c                     t        g d      }t        t        d      |      }|j                  j	                  d      sJ |j                         }|j                  j	                  d      sJ y )N)r   r   r   rC   r)   )r   r   r   )r
   r   r,   r*   _is_scalar_accessto_frame)r/   r   serrV   s       r3   test_is_scalar_accessz-TestiLocBaseIndependent.test_is_scalar_access   sW    i U1XU+xx))$///\\^ww((000r5   z,https://github.com/apache/arrow/issues/40642)reasonc           
      (   t        t        j                  j                  d      j                  d      t	        d            }d}t        j                  t        |      5  |j                  d d g df    d d d        t        j                  t        |      5  |j                  dd	g    d d d        t        j                  t        |      5  |j                  dd
g    d d d        t        j                  t        |      5  |j                  dg    d d d        |d   }t        j                  t        |      5  |j                  dg    d d d        t        j                  t        |      5  |j                  dg    d d d        d}t        j                  t        |      5  |j                  d	    d d d        t        j                  t        |      5  |j                  d
    d d d        t        j                  t        |      5  |j                  d	    d d d        t        j                  t        |      5  |j                  d
    d d d        |j                  d d ddf   }|j                  d d dd f   }t        j                  ||       |j                  d d ddf   }|j                  d d d df   }t        j                  ||       |j                  d d dddf   }|j                  d d d ddf   }t        j                  ||       |j                  d d dddf   }|j                  d d dd df   }t        j                  ||       |j                  d d ddf   }|j                  d d d df   }t        j                  ||       |j                  d d ddf   }|j                  d d d df   }t        j                  ||       |j                  d d dddf   }|j                  d d d df   }t        j                  ||       |j                  d d ddf   }|j                  d d d df   }t        j                  ||       |j                  dd	 }|j                  dd  }t        j                  ||       |j                  d	d  }|j                  d d }t        j                  ||       |j                  d	d d   }|j                  d d d   }t        j                  ||       t        t        j                  j                  d      j                  d      t	        d            }t        j                  |j                  d d ddf   t        |j                  t        g |j                  j                                      t        j                  |j                  d d ddf   |j                  d d dgf          t        j                  |j                  dd |j                  dg          d}t        j                  t        |      5  |j                  g d    d d d        d}t        j                  t        |      5  |j                  d d df    d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   cxY w# 1 sw Y   <xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nr   )      ABCDEcolumnsz%positional indexers are out-of-boundsmatchr   r   r   rC   r"   rm   r      id   Aiz*single positional indexer is out-of-boundsr"   
   ir   r   i      rm   r   ABrC   r    r   rp      r"   rm   r~   )r	   r>   randomdefault_rngr<   r9   raisesr.   r*   rQ   rR   assert_series_equalstandard_normalr   r
   rp   r!   )r/   rV   msgsresultrX   dfls          r3   test_iloc_exceeds_boundsz0TestiLocBaseIndependent.test_iloc_exceeds_bounds   s    ryy,,Q/66w?gW 6]]:S1 	+GGA))*	+]]:S1 	GGQG	]]:S1 	GGQH	]]:S1 	GGSEN	 sG]]:S1 	FFC5M	]]:S1 	FFD6N	 ;]]:S1 	GGBK	]]:S1 	GGCL	 ]]:S1 	FF2J	]]:S1 	FF3K	 AbD!771ab5>
fh/BsF#771bqb5>
fh/BqG$771eqe8$
fh/Ac"H%771aee8$
fh/CE"771bqb5>
fh/BqD!771bqb5>
fh/CBJ'771bqb5>
fh/BrE"771bqb5>
fh/ 266"#;
vx066"1:
vx0B66$B$<
vx0 II!!!$44V<d4j
 	HHQ!VCIIuRs{{?P?P/QR	
 	chhq!A#v.QC0@A
chhqmSXXqc];5]]:S1 	 HHY	 :]]:S1 	HHQTN	 	w	+ 	+	 		 		 		 		 	
	 		 		 		 	z	  	 	 	s    Y:ZZZ!<Z.0Z;&[[["?[/&[<\:ZZZ!Z+.Z8;[[["[,/[9<\\zindex,columnsrl   rn   zindex_vals,column_valsrv   D12i  r   c                 &   t        t        j                  j                  d      j	                  t        |      t        |      f      ||      }d}t        j                  t        |      5  |j                  ||f    d d d        y # 1 sw Y   y xY w)Nr   r}   z$.iloc requires numeric indexers, gotrq   )
r	   r>   r   r   r   r-   r9   r   r.   r*   )r/   r   rp   
index_valscolumn_valsrV   r   s          r3   test_iloc_non_integer_raisesz4TestiLocBaseIndependent.test_iloc_non_integer_raises   sy     II!!!$44c%j#g,5OP

 5]]:S1 	-GGJ+,	- 	- 	-s   ,BBc                 
   t        t        j                  d      j                  dd            }t	        j
                  ||      }t        j                  t        d      5  |j                  d    d d d        y # 1 sw Y   y xY w)Nru   rw   zCannot index by location indexrq   a)
r	   r>   arangereshaperQ   get_objr9   r   	TypeErrorr*   )r/   r0   r2   s      r3    test_iloc_getitem_invalid_scalarz8TestiLocBaseIndependent.test_iloc_getitem_invalid_scalar  sb     		#..r267jjo.]]9,LM 	HHSM	 	 	s    A99Bc                     t        j                  g d      }|j                         }t        g dg dg ddg d      }|j                  |    t        j                  ||       |j                  d d |f    t        j                  ||       y )N)r   r   r   )ru   e   f   )g   h   i   )j   k   l   rv   BCr   r   rC   r)   )r>   r   rM   r	   r*   rQ   assert_numpy_array_equal)r/   array_with_neg_numbers
array_copyrV   s       r3   -test_iloc_array_not_mutating_negative_indiceszETestiLocBaseIndependent.test_iloc_array_not_mutating_negative_indices  sy    !#*!5+002
!oN
 	&'
##$:JG
))*
##$:JGr5   c                 &   t        g dg dd      }|d   }|j                  d   }|j                  d   }t        j                  ||       |j                  dg   }|j                  dg   }t        j                  ||       |j                  d   }|j                  d   }||k(  sJ |j                  dg   }|j                  dg   }t        j                  ||       t        dgdg      }|j                  d	g   }t        j                  ||       y )
N)r   rC   rm   )   ry      rv   r   rv   r   r   r)   r   )r	   r*   rQ   r   rR   r   )r/   rV   r   rX   r   s        r3   /test_iloc_getitem_neg_int_can_reach_first_indexzGTestiLocBaseIndependent.test_iloc_getitem_neg_int_can_reach_first_index*  s     Y[9:sG771:
vx077A3<"
fh/66!9!!!661#;
vx0 3%u-t$
vx0r5   c                 <   t        d dddddg      }t        ddddddg      }t        ||gd      }|j                  d   }t        |      sJ |j                  dd d f   }t	        t
        j                  dddgg d	d
      }t        j                  ||       y )Nr   r   r   rC   r"   axisrH   r   rv   r   rv   r   )r   name)	r	   r   r*   r   r   r>   nanrQ   r   )r/   df1df2rV   r   rX   s         r3   test_iloc_getitem_dupsz.TestiLocBaseIndependent.test_iloc_getitem_dupsE  s    t!,AA.>?@qq)+;<=S#JQ' F||A2661a+3GaP
vx0r5   c                    t        dddddddddd	d
dg      }t        ddddg      }t        j                  |j                  dg   |       t        ddddddddg      }t        j                  |j                  ddg   |       t        dddd	d
dgddg      }|j                  ddgddgf   }t        j                  ||       y )Nr   r   rC   r   ru      ,        r   )r   r   r)   )r	   rQ   rR   r*   r/   rV   rX   r   s       r3   test_iloc_getitem_arrayz/TestiLocBaseIndependent.test_iloc_getitem_arrayS  s    aa(#.D1
 AAA678
bggqclH5AAA6cRU8VWX
bggq!fox8AA.d0FGPQSTvV!Q!Q(
fh/r5   c                 .   t        dddddddddd	d
dg      }t        ddddddddg      }|j                  g d   }t        j                  ||       t        dddddd	d
dgddg      }|j                  d    }t        j                  ||       y )Nr   r   rC   r   ru   r   r   r   r   r   )TTFr   r)   c                 &    | j                   dz  dk(  S )Nr   r   r)   xs    r3   <lambda>z@TestiLocBaseIndependent.test_iloc_getitem_bool.<locals>.<lambda>v  s    177Q;!#3 r5   r	   r*   rQ   rR   r   s       r3   test_iloc_getitem_boolz.TestiLocBaseIndependent.test_iloc_getitem_boolf  s    aa(#.D1
 AAA6cRU8VWX,-
fh/11%T4'HIRSUVQW
 34
fh/r5   r   )TFTFc                     t        g d      }dt        |       dt        |       }t        j                  t        |      5  |j
                  |    d d d        y # 1 sw Y   y xY w)Nr   z Boolean index has wrong length: z instead of rq   )r   r-   r9   r   r.   r*   )r/   r   r   r   s       r3   test_iloc_getitem_bool_diff_lenz7TestiLocBaseIndependent.test_iloc_getitem_bool_diff_leny  sV     90ULQQ]]:S1 	FF5M	 	 	s   AA%c                    t        dddddddddd	d
dg      }t        ddddddddg      }|j                  d d }t        j                  ||       t        dddgdg      }|j                  ddddf   }t        j                  ||       t        dddddddd
dg      }|j                  d d d f   }t        j                  ||       y )Nr   r   rC   r   ru   r   r   r   r   r   r   r)   r   )rv   r   c                 
    ddgS )Nr   r   r@   )rV   s    r3   r   zATestiLocBaseIndependent.test_iloc_getitem_slice.<locals>.<lambda>  s
    1v r5   r   r   s       r3   test_iloc_getitem_slicez/TestiLocBaseIndependent.test_iloc_getitem_slice  s    aa(#.D1
 AAA6cRU8VWX!
fh/Cc23A3?1ac"
fh/1Ss34d5KL
 --.
fh/r5   c                    t        t        j                  j                  d      j	                  d      g d      }t        t        j                  j                  d      j                  ddd      j                  dd      d	d
g      }t        ||gd      }t        j                  |j                  d d d df   |       t        j                  |j                  d d dd f   |       t        ||gd      }t        j                  |j                  d d d df   |       t        j                  |j                  d d dd f   |       t        ||j                  d d dgf   gd      }t        j                  |j                  d d ddf   |       t        ||gd      }t        j                  |j                  ddd df   |       t        j                  |j                  dddd f   |       t        j                  |j                  dd d df   |       t        j                  |j                  dd dd f   |       y )Nr   rw   r"   )rv   rv   r   r   ro   r   rw   rl   sizerv   r   r   r   r"   rC   )r	   r>   r   r   r   integersr   r   rQ   rR   r*   )r/   r   r   rV   exps        r3   test_iloc_getitem_slice_dupsz4TestiLocBaseIndependent.test_iloc_getitem_slice_dups  s   II!!!$44W=(
 II!!!$--a"-=EEb!L#J
 S#JQ'
bgga!enc2
bggaenc2S#JQ'
bgga!enc2
bggaenc2c388AsF+,15
bgga1fos3 RH1%
bggadBQBh/5
bggadABh/5
bggbc2A2g.4
bggbc12g.4r5   c           	      j   t        t        j                  j                  d      j	                  d      t        j
                  ddd      t        j
                  ddd            }|r|d d  }d|j                  d	<   |j                  d	   }|dk(  sJ d|j                  d d ddf<   |j                  d d ddf   }|j                  d d ddf   }t        j                  ||       t        dg d
      }|j                  ddxxx dz  ccc t        g dg d
      }t        j                  ||       y )Nr   r"   r"   r   r$      rC   r}   r   r   r   r   r)   r   r   r   )r	   r>   r   r   r   r   r*   rQ   rR   r   r   )selrZ   rV   rb   r   rX   r   s          r3   test_iloc_setitemz)TestiLocBaseIndependent.test_iloc_setitem  s
   II!!!$44V<))Aq!$IIaQ'

 a5D{{1Q3771ac6?AaC
fh/ 1I&	qq)95
q(+r5   c                 D   t        g dg dg dg      }|d   j                  t              |d<   |r|d d  }t        g dg dg dg      }|d   j                  t              |d<   d|j                  d      d	<   t	        j
                  ||       t        g dg dg dg      }|d   j                  t              |d<   |r|d d  }t        g d
g dg dg      }|d   j                  t              |d<   d|j                  d      d	<   t	        j
                  ||       y )N)r~   crw   )r   dry   )r$   er   r   )rm   rm   rm   rm   r   r   r   )r~   r   rm   )r   r   rm   )r$   r   rm   )r	   rO   r=   r*   rQ   rR   r/   rZ   rV   rb   rX   s        r3   test_iloc_setitem_axis_argumentz7TestiLocBaseIndependent.test_iloc_setitem_axis_argument  s    lLAB1V$1a5DlL)DEqk((0Q
b(+lLAB1V$1a5Dk;DEqk((0Q
b(+r5   c                 v   t        t        j                  d      j                  d      g dg d      }|r|d d  }|j                  ddgddgf    |j                  ddgddgfxx   dz  cc<   t        t        j
                  g d	      j                  d      g dg d      }t        j                  ||       y )
N	   rC   rC   r   r}   r   r   r   ru   )	r   r   r   rC   r   r   r~   r   r$   )r	   r>   r   r   r*   r   rQ   rR   r   s        r3   test_iloc_setitem_listz.TestiLocBaseIndependent.test_iloc_setitem_list  s     IIaL  (
 a5D
AA
AA3&HH89AA&I!#

 	b(+r5   c                 @   t        g d      }t        g d      }|j                         }ddg|j                  t        ddg      <   t        j                  ||       |j                         }ddg|j                  t        ddg      <   t        j                  ||       y )N)r   r   r   rC   )r   r   rC   r   r   r   r   )r   rM   r*   rQ   r   r
   )r/   s_origrX   r   s       r3   test_iloc_setitem_pandas_objectz7TestiLocBaseIndependent.test_iloc_setitem_pandas_object  s    %.)KKM"$bvq!f~
q(+KKM!#RuaV}
q(+r5   c                 V   t        d dddddg      }t        ddddddg      }t        ||gd      }|j                  d      }t        j                  |j
                  d d df         }||   j                  }|j
                  |df   |j
                  |df<   t        j                  ||       t        ddgddgd      }d	d	g|_	        |d
= t        j                  ||       |j
                  ddgddgf   |j
                  ddgddgf<   t        j                  ||       |j
                  ddgddgf   j                  d      |j
                  ddgddgf<   |j
                  ddgddgf   j                  d      |j
                  ddgddgf<   t        j                  ||       y )Nr   r   r   rC   r"   r   r   rI   r   rv   T)drop)r	   r   fillnar>   isnanr*   r   rQ   rR   rp   reset_index)r/   r   r   rV   rX   indsmasks          r3   test_iloc_setitem_dupsz.TestiLocBaseIndependent.test_iloc_setitem_dups  s    t!,AA.>?@qq)+;<=S#JQ'99Q<xx1&Dz7747+a
b(+ !QQF34:sG
b(+ #%''1a&1a&."9AA
b(+ #%''1a&1a&."9"E"E4"E"PAA"$''1a&1a&."9"E"E4"E"PAA
b(+r5   c                 &   t        ddgddggddg      }|j                  d d df   j                  d      |j                  d d df<   t        |j                  j
                        dk(  sJ t        j                  t        d	      5  |j                  d d df   d
z   |j                  d d df<   d d d        |j                         }|j                  ddgddgf   |j                  ddgddgf<   t        j                  ||       y # 1 sw Y   XxY w)Nr   r   r   rC   r   ro   f8Invalid valuerq   g      ?)r	   r*   rO   r-   rJ   rK   r9   r   r   rM   rQ   rR   r/   rV   rX   s      r3   9test_iloc_setitem_frame_duplicate_columns_multiple_blockszQTestiLocBaseIndependent.test_iloc_setitem_frame_duplicate_columns_multiple_blocks  s     AA'#s< 1,,T21277>>"a''' ]]9O< 	0GGAqDMC/BGGAqDM	0 779 #%''1a&1a&."9AA
b(+	0 	0s   (DDc           	         t        t        j                  j                  d      j	                  d      t        ddd      t        ddd            }|j                  d   }|j                  d   }t        j                  ||       |j                  d   }|j                  d	   }||k(  sJ |j                  dd }|j                  dd
 }t        j                  ||       |j                  d d ddf   }|j                  d d ddf   }t        j                  ||       |j                  g d   }|j                  g d   }t        j                  ||       |j                  g dddgf   }|j                  g dddgf   }t        j                  ||       |j                  g dddgf   }|j                  g dddgf   }t        j                  ||       |j                  g dddgf   }|j                  g dddgf   }t        j                  ||       t        t        dd      t              }|j                  |j                     }|j                  g d   }t        j                  ||       y )Nr   r   r   rl   r$   r}   r"   )r   r   r      rC   rm   )r   r   rC   )r   r   r~   r   )r   r   rC   r   )rz   r   r~   r~   )r   r   r   rC   )rz   rz   r   r~   )r   r!   )r   r"   r~   r$   )r	   r>   r   r   r   r,   r*   locrQ   r   rR   r   r=   r   )r/   rV   r   r   rX   r   s         r3   test_iloc_getitem_framez/TestiLocBaseIndependent.test_iloc_getitem_frame6  s+   II!!!$44W=2q/!QN
 ffQi
vs+ffTl}} 166!B<
fh/AaC66!QqS&>
fh/ #66)$
fh/QF*+66)aV+,
fh/ b!W,-66*q!f,-
fh/ "a0166.1a&01
fh/ q!F3!66,'
fh/r5   c                    t        t        j                  j                  d      j	                  d      t        d      t        d            }|j                  d   }|j                  d   }||k(  sJ |j                  d d ddf   }|j                  d d d	gf   }t        j                  ||       |j                  d
   }|j                  d   }||k(  sJ d}t        j                  t        |      5  |j                  d    d d d        d}t        j                  t        |      5  |j                  d    d d d        y # 1 sw Y   ?xY w# 1 sw Y   y xY w)Nr   r   
abcdefghijABCDr}   r   )br   rC   r   )r   r   )jr   zCindex 5 is out of bounds for axis 0 with size 4|index out of boundsrq   )rw   rm   zLocation based indexing can only have \[integer, integer slice \(START point is INCLUDED, END point is EXCLUDED\), listlike of integers, boolean array\] types)r	   r>   r   r   r   r<   r*   r   rQ   rR   r9   r   r.   
ValueError)r/   rV   r   r   rX   r   s         r3    test_iloc_getitem_labelled_framez8TestiLocBaseIndependent.test_iloc_getitem_labelled_frameg  s9   II!!!$44W=|$L
 ffX}}AaC66!cU(#
fh/ ffX}} T]]:S1 	GGEN	
; 	
 ]]:S1 	GGH	 		 		 	s   3E(EE
Ec                    t         j                  j                  d      j                  d      }t	        dd      }t        d      }t        |||      }|j                          |j                  dd	d
df   }t        |dd	d
df   |dd	 |d
d       }t        j                  ||       t        d      |_        |j                  dd	d
df   }t        |dd	d
df   |dd	 t        d            }t        j                  ||       t         j                  j                  d      j                  d      }t        t        d
dd            }t        t        d
dd            }t        |||      }|j                  j                  d
   j                   |j                  dd	ddf   }t        |dd	ddf   |dd	 |dd       }t        j                  ||       y )Nr   )r~   r"   r%   r~   r&   r   r}   rC   rm   r   aaaaaar   r$   r   r"   )r>   r   r   r   r   r<   r	   describer*   rQ   rR   rp   r,   rJ   rK   mgr_locs)r/   ra   r   rp   rV   r   rX   s          r3   test_iloc_getitem_doc_issuez3TestiLocBaseIndependent.test_iloc_getitem_doc_issue  s    ii##A&66v>:q1v,s%9 	1ac"S1ac]%!*gaPQlS
fh/ &\
1ac"S1ac]%!*d4jQ
fh/ ii##A&66v>U1b!_%uQ1~&s%9
q""1ac"S1ac]%!*gaPQlS
fh/r5   c                    t        t        j                  j                  d      j	                  d      t        d      t        d            }|r|d d  }d|j                  d<   |j                  d   }|dk(  sJ d|j                  d d dd	f<   |j                  d d dd	f   }|j                  d d dd	f   }t        j                  ||       t        t        j                  j                  d      j	                  d
      t        ddd            }d|j                  d<   |j                  d   }|dk(  sJ d|j                  d d |j                  d d }|j                  d d }t        j                  ||       t        dgdz        }g d|j                  dd d<   g d|j                  dd d<   |}t        g d      }t        j                  ||       y )Nr   r   r   r   r}   r   r   r   rC   rw   rl   r)   r"   r   r~   r   r   r"   )r   rC   rm   rs   )r	   r>   r   r   r   r<   r*   rQ   rR   r   r,   r   )r/   rZ   rV   rb   r   rX   r   s          r3   test_iloc_setitem_seriesz0TestiLocBaseIndependent.test_iloc_setitem_series  s   II!!!$44W=|$L

 a5D{{1Q3771ac6?AaC
fh/299((+;;B?uQPRTUWq	{{r
66"1:
vx0B4!8 qt!t qt!t,-
vx0r5   c                    t        t        j                  dd      t        j                  ddd      d      }|r|d d  }ddgddgg|j                  d	d
 t        g dg dd      }t	        j
                  ||       t        g dt        j                  ddd      d      }|r|d d  }ddgddgg|j                  d	d
 t        g dg dd      }t	        j
                  ||       y )Nrm   int64r    rw   r   ry   r   r   r   r"   )r   r   rw   r   r"   )rm   r~   ry   r   r   r   r   r   r   r   r   y)r   r   r   r  r   )r	   r>   r   r*   rQ   rR   r   s        r3   test_iloc_setitem_list_of_listsz7TestiLocBaseIndependent.test_iloc_setitem_list_of_lists  s     ))AW-BIIa74ST
 a5DR2r(+!#4;LMN
b(++"))Ar2QR
 a5Db	C9-!#<CTUV
b(+r5   indexerr   valueZc                     t        ddgddggddg      j                  dt        i      }|r|d d  }||j                  d|f<   |j                  d	   }t	        |      r|d
k(  sJ y )Nr   r   rC   r"   rv   r   ro   r   rH   r  )r	   rO   r=   r*   r   )r/   rZ   r  r  rV   rb   r   s          r3   #test_iloc_setitem_with_scalar_indexz;TestiLocBaseIndependent.test_iloc_setitem_with_scalar_index  sq     AA'#s<CCS&MRa5D#7
 Vs]22]r5   zignore::UserWarningc           
         t        t        t        d            t        d      dg      }|j                  dz  dk(  }d}t	        j
                  t        |      5  |j                  |    d d d        t        t        |            |_	        d	}t	        j
                  t        |      5  |j                  |    d d d        |j                  t        j                  d
gt        |      z  t                 }t        j                  ||       t        j                   d      }d|z  }|D cg c]  }t#        |       }}t        ||d|      }ddddddd	d	d	d	}	dD ]  }
|j$                  dkD  j&                  }|
r't)        ||
      d d d   }t+        |t        |            }dD ]  }	 |rt)        ||dd        }n|}t-        t#        ||   d   j/                                     }|
|f}|	j1                  |      }|

|
dk(  r|dk7  rd|v r||k(  rkJ d| d| d       ||v r~J d| d| d         y # 1 sw Y   xY w# 1 sw Y   xY wc c}w # t        t        f$ r}t-        |      }Y d }~d }~ww xY w)Nrm   rn   r   r}   r   r   zBiLocation based boolean indexing cannot use an indexable as a maskrq   .Unalignable boolean Series provided as indexerTr    r"   )locsnums0b11000b11)	)N )N.loc)N.iloc)r   r  )r   r  )r   r  )r  r  )r  r  )r  r  )Nr   r  r   )r  r  r  r   r  r   r  0b[z] does not match []z] not found in [)r	   r<   r,   r   r9   r   r   r*   r-   r   r   r>   r   boolrQ   rR   r   binr  rN   getattrr   strsumget)r/   rV   r   r   r   r  r  numrepsrX   idx
mask_indexmethodaccessoranswererrr   expected_results                     r3   test_iloc_maskz&TestiLocBaseIndependent.test_iloc_mask  s    tE!H~T']SEJttax1}R]]:S1 	GGDM	 3t9%
>]]=4 	GGDM	 4&3t9"4DAB
fb) yy|$w$()SC))d3T: !$%!% TJNO
  + 	YCGGaK''D$R-dd3
dD$45/ Y&#*2vabz#:#% Xd^F%;%?%?%A!BCF
  #+,,s"3 KC7Nv7Ho-*f4 C5 26(!<4
 +f4X#>NvhVW6XX45Y	YE	 	
	 	 *> #M2 & XF&s6   H1(H>)I%<I1H;>II4I//I4c                     t        t        t        d            t        d      dg      }|j                  t	        j
                  g dt                 }t        dg dig d	      }t        j                  ||       y )
Nrm   rn   r   r}   TFTFTr    r  )rv   r   Er)   )	r	   r<   r,   r*   r>   r   r  rQ   rR   r/   rV   r   rX   s       r3   test_iloc_with_numpy_bool_arrayz7TestiLocBaseIndependent.test_iloc_with_numpy_bool_arrayB  sY    tE!H~T']SEJ"B$OPc9-_E
fh/r5   c                 6   t        t        t        d            t        d      dg      }|j                  dz  dk(  }d}t	        j
                  t        |      5  |j                  t        d	gt        |      z  t        
          d d d        y # 1 sw Y   y xY w)Nrm   rn   r   r}   r   r   r  rq   Tr    )r	   r<   r,   r   r9   r   r   r*   r   r-   r  )r/   rV   r   r   s       r3   0test_iloc_series_mask_with_index_mismatch_raiseszHTestiLocBaseIndependent.test_iloc_series_mask_with_index_mismatch_raisesH  su    tE!H~T']SEJttax1}>]]=4 	<GGFD6CI-T:;	< 	< 	<s   ,BBc                     t        t        t        d            dg      }t        dgt	        |      z  t
              }|j                  |   }t        j                  ||       y )Nrm   r   ro   Tr    )	r	   r<   r,   r   r-   r  r*   rQ   rR   )r/   rV   r   r   s       r3   test_iloc_series_mask_all_truez6TestiLocBaseIndependent.test_iloc_series_mask_all_trueO  sL    tE!H~u5tfs2w&d3
fb)r5   c                     t        t        t        d            dg      }t        g dt              }|j
                  |   }t        dg dig d      }t        j                  ||       y )Nrm   r   ro   r0  r    r  r)   )r	   r<   r,   r   r  r*   rQ   rR   )r/   rV   r   r   rX   s        r3   $test_iloc_series_mask_alternate_truez<TestiLocBaseIndependent.test_iloc_series_mask_alternate_trueU  sS    tE!H~u56dCc9-Y?
fh/r5   c                    t        dgdz  dgdz  d      }t        j                  d      dz  }|j                  |   }t	        |d|z  d|z  g      }|j                  |   }t        j                  ||       t        dgd	z  dgd	z  d      }t	        |d|z  d|z  g      }t        j                  t        d
      5  |j                  |    d d d        y # 1 sw Y   y xY w)N皙?r   r   r   rt   c   r   rC   r   znot in indexrq   )r	   r>   r   r*   r   rQ   rR   r9   r   KeyErrorr   )r/   rV   r'  rX   df3r   r   s          r3   test_iloc_non_unique_indexingz5TestiLocBaseIndependent.test_iloc_non_unique_indexing\  s    cUT\d
;<iimb 773<b!b&!b&)*#
fh/sedl!t<=c1s7AG,-]]8>: 	GGCL	 	 	s   <CCc                 T   t        t        j                  d      t        t	        d      D cg c]  }d| 	 c}d      t        t	        d      D cg c]  }d| 	 c}d            }t        j                  |j                  d d g f   |j                  d d d df   d	d	
       t        j                  |j                  g d d f   |j                  d dd d f   d	d	
       t        j                  |j                  g    |j                  d dd d f   d	d	
       y c c}w c c}w )Nr{   rm   zi-r   r   r   r}   r   T)check_index_typecheck_column_type)r	   r>   onesr
   r,   rQ   rR   r*   )r/   irV   s      r3   "test_iloc_empty_list_indexer_is_okz:TestiLocBaseIndependent.test_iloc_empty_list_indexer_is_okm  s    GGFO584a2aS43?U1X6Rs86SA
 	GGArENGGArrEN!"		
 	GGBENGGBQBEN!"		
 	GGBK!Q$RV	
% 56s   D D%c                 b   t        dg di      }|j                  d d  }||usJ t        j                  |d   |d         sJ g d|j                  d d df<   |d   g dk(  j                         sJ t        g d      }|j                  d d  }||usJ g d|d d t        |d d g dk(        sJ y )Nr   r   )r"   r"   r"   )r   r   rC   r"   rm   r~   r   r$   r   rC   )r	   r*   r>   rP   r   allr   )r/   original_df	sliced_dforiginal_seriessliced_seriess        r3   &test_identity_slice_returns_new_objectz>TestiLocBaseIndependent.test_identity_slice_returns_new_object  s    i 01$$Q'	+++ C 0)C.AAA #,3#)+00222 !34',,Q/O333 (=!$	1222r5   c                     t        ddgddgg      }|j                  t        j                  d         }t	        ddgd      }t        j                  ||       y )Nr   r   rC   r"   r   rA  )r	   r*   r>   r   r   rQ   r   )r/   rV   r   r   s       r3   test_indexing_zerodim_np_arrayz6TestiLocBaseIndependent.test_indexing_zerodim_np_array  sO    AA'(!%Aq6"
vq)r5   c                 p    t        ddg      }|j                  t        j                  d         }|dk(  sJ y )Nr   r   r   )r   r*   r>   r   )r/   r   r   s      r3   %test_series_indexing_zerodim_np_arrayz=TestiLocBaseIndependent.test_series_indexing_zerodim_np_array  s1    Aq6N${{r5   c                 .   t        g d      }t        |g ddd      }t        j                  |d   |      sJ |d d d   |j                  d d df<   t        j                  |d   |      sJ t        g d	g d
      }t        j
                  ||       y )Nr   r   )r   r   FrM   r   r   r   )r   r   rv   
categories)r   r	   rQ   rP   r*   assert_categorical_equal)r/   rU   rV   rX   s       r3   -test_iloc_setitem_categorical_updates_inplacezETestiLocBaseIndependent.test_iloc_setitem_categorical_updates_inplace  s    /*39-E:1s+++ DbD	11s+++?K
##C2r5   c                    t        ddgddgddgdt        j                  gg      }|j                  |j                  dk  xx   dz  cc<   t        ddgddgdd	gdt        j                  gg      }t        j                  ||       |j                  |j                  dkD  xx   dz  cc<   t        ddgddgdd	gd
t        j                  gg      }t        j                  ||       |j                  g dxx   dz  cc<   t        ddgdd
gdd	gd
t        j                  gg      }t        j                  ||       |j                  g dxx   dz  cc<   t        ddgddgddgdt        j                  gg      }t        j                  ||       y )Nr   r   r   rC   r"   rm   r~   r$   rw   r   )TTFF)FFTTg      @g      (@g      @)r	   r>   r   r*   r   rQ   rR   )r/   r   rX   s      r3    test_iloc_with_boolean_operationz8TestiLocBaseIndependent.test_iloc_with_boolean_operation  si   QFQFQFQK@AFLLA%&!+&q!fq!fq"g266{CD
fh/FLL1$%*%q!fq!fq"gBFF|DE
fh/./14/q!fq"g2wRVVEF
fh/./14/q#hD	As8a[IJ
fh/r5   c                     t        dt        dj                               i      }|j                  d   }t        dgg d      }t	        |dgdd      }t        j                  ||       y )	Nr   z	a b c d er   r   r  rU  category)r   r   r!   )r	   r   splitr*   r   rQ   r   )r/   rV   r   raw_catrX   s        r3   ?test_iloc_getitem_singlerow_slice_categoricaldtype_gives_serieszWTestiLocBaseIndependent.test_iloc_getitem_singlerow_slice_categoricaldtype_gives_series  s]    [):):)<=>?se0IJ'#QjI
vx0r5   c                 
   t        g d      j                  d      }|j                  dd }t        ddg      j                  t        g d            }t	        j
                  ||       |j                  ddg   }t        ddg      j                  t        g d            }t	        j
                  ||       |j                  g d   }t        dg      j                  t        g d            }t	        j
                  ||       y )Nr   r\  r   r   r   TFF)r   rO   r*   r   rQ   r   )r/   rh   r   rX   s       r3   $test_iloc_getitem_categorical_valuesz<TestiLocBaseIndependent.test_iloc_getitem_categorical_values  s     Y&&z2 !A1a&>(()9))DE
vx0 1a&!1a&>(()9))DE
vx0 ./1#;%%&6y&AB
vx0r5   c                     t        g dd      }||j                  d<   t        t        ddgd      }t        j                  ||       y )Nr   ztimedelta64[ns]r    r   r   r   )r   r*   r   rQ   r   )r/   r  seriesrX   s       r3   %test_iloc_setitem_td64_values_cast_naz=TestiLocBaseIndependent.test_iloc_setitem_td64_values_cast_na  sA     	):;A31+->?
vx0r5   not_nar   g      ?c                     t        |g      }t        ||||g|      }|||g|j                  d d t        ||||g|      }t        j                  ||       y )NrU  r    rC   )r   r   r*   rQ   r   )r/   rf  nulls_fixturer!   rh   r   s         r3   $test_setitem_mix_of_nan_and_intervalz<TestiLocBaseIndependent.test_setitem_mix_of_nan_and_interval  sg     !VH5M=-HPU
 &v}=!mV]MJRWX
sC(r5   c                    t        g       }t        t        j                  j	                  d      j                  t        |      t        |      f      ||      }t        j                  j	                  d      j                  dd      }d|j                   }t        j                  t        |      5  d|j                  |<   d d d        y # 1 sw Y   y xY w)	Nr   r}   rm   )r   r   r   r   zCannot set values with ndim > rq   r   )r
   r	   r>   r   r   r   r-   r   ndimr9   r   r   r*   )r/   r'  r2   nd3r   s        r3   4test_iloc_setitem_empty_frame_raises_with_3d_ndarrayzLTestiLocBaseIndependent.test_iloc_setitem_empty_frame_raises_with_3d_ndarray  s    BiII!!!$44c#hC5IJ

 ii##A&//	/B.sxxj9]]:S1 	CHHSM	 	 	s   4CCc                    t        j                  d      }t        |      }t        j                  d      }|j                  d       t        |      }t	        j
                   ||      g d    ||      g d          t	        j
                   ||      dg    ||      dg          t	        j                   ||      d    ||      d          t	        j
                   ||      dd  ||      dd        y )Nrw   F)writer   r   rC   )r>   eyer	   setflagsrQ   rR   r   )r/   rS   rw_arrayrw_dfro_arrayro_dfs         r3   "test_iloc_getitem_read_only_valuesz:TestiLocBaseIndependent.test_iloc_getitem_read_only_values
  s     66":(#66":&(#
ui(*U*;I*F	
 	j/4j6G6LM
z%03Z5Fq5IJ
j/!4j6G!6LMr5   c                 |   t        dt        j                  dd      i      }t        j                  g d      }d|j                  _        |j                  |   }|j                  g d   }t        j                  ||       |d   j                  |   }|d   j                  g d   }t        j                  ||       y )Ndataru   r?   r    )r   rC   r~   F)r	   r>   rD  r   flags	writeabler*   r   rQ   rR   r   )r/   rV   indicesr   rX   s        r3   test_iloc_getitem_readonly_keyz6TestiLocBaseIndependent.test_iloc_getitem_readonly_key  s    9 =>?((9%"'!66)$
fh/F)f:>>),
vx0r5   c                     t        dgdg      }t        g d      |j                  d<   t        dt        g d      gidgdg      }t        j                  ||       y )Nr   r   rp   r   r   rH   )r	   r   r*   rQ   rR   r   s      r3   "test_iloc_assign_series_to_df_cellz:TestiLocBaseIndependent.test_iloc_assign_series_to_df_cell)  sS    uQC0y)cF9$5#67#qcR
b(+r5   klassc                     t        g dg dd      } |g d      }|j                  |df   dz  |j                  |df<   t        g dg dd      }t        j                  ||       y )N)r   r  z)r   rC   r"   )flagr  ra  r   r   )r   rC   r"   r   )r/   r  rV   r  rX   s        r3   test_iloc_setitem_bool_indexerz6TestiLocBaseIndependent.test_iloc_setitem_bool_indexer0  sa     )DE,- gggqj1A5
o	JK
b(+r5   r   c                     t        g dg dd      }t        g dg dg dd      }|r|d d  }|j                  d d dgf   |j                  d d |f<   t        g dg dg dd      }t        j                  ||       y )	N)ry   r   r   )r         )a2b2r   r   rH  r   r   r   r   r   )r/   r  rZ   r   r   rb   rX   s          r3   %test_iloc_setitem_pure_position_basedz=TestiLocBaseIndependent.test_iloc_setitem_pure_position_based9  sr     |<@AiiiHIq6D"xxA3/G9<iPQ
c8,r5   c                 N   t        ddgddgd      }|r|d d  }ddd}||j                  d<   t        ddgddgd      }t        j                  ||       t        ddgddgd      }|r|d d  }||j                  d<   t        ddgddgd      }t        j                  ||       y )Nr   r   )r   r  r   r<  g       @g     X@r   )r/   rZ   rV   rb   rhsrX   s         r3   "test_iloc_setitem_dictionary_valuez:TestiLocBaseIndependent.test_iloc_setitem_dictionary_valueE  s     aV1a&12a5DB
Aq6B89
b(+ aV3*56a5D
Aq6d<=
b(+r5   c                    t        t        j                  j                  d      j	                  d      g dt        d            }|j                  dd  }t        j                  |j                  d   |       |j                  dd df   }t        j                  |j                  d	   |       g d
|_        |j                  dd  }t        j                  |j                  d   |       |j                  dd df   }t        j                  |j                  d	   |       t        t        j                  j                  d      j	                  d      g dt        d            }|j                  dd }t        j                  |j                  d   |       |j                  dddf   }t        j                  |j                  d	   |       g d|_        |j                  ddg   }t        j                  |j                  d   |       |j                  ddgdf   }t        j                  |j                  d	   |       y )Nr   r   )r;  皙?r  abcr}   r   r  r   )r  r   )r   r  r  )r"   rC   )r   r  r  r   r   )r;  r  r   r  )r	   r>   r   r   r   r<   r*   rQ   rR   r   r   r   )r/   rV   expects      r3   "test_iloc_getitem_float_duplicatesz:TestiLocBaseIndependent.test_iloc_getitem_float_duplicatesX  s   II!!!$44V<!K

 
bffSk62Q
rvvh/8 
bffSk62Q
rvvh/8II!!!$44V<"K

 2
bffSk622q!
rvvh/8%!R!
bffSk62!R!$
rvvh/8r5   c                     G d d      }t        ddgdg      } |d      |j                  d<    |d      |j                  d<   t        ddgdg      } |d      |j                  d<   t        j                  ||       t        ddgdg      } |d      |j                  d<   t        j
                  |j                  d<   t        ddgdg      }t        j                  ||       y )Nc                   6    e Zd ZddZdefdZeZdefdZd Z	y)CTestiLocBaseIndependent.test_iloc_setitem_custom_object.<locals>.TOreturnNc                     || _         y Nr  )r/   r  s     r3   __init__zLTestiLocBaseIndependent.test_iloc_setitem_custom_object.<locals>.TO.__init__  s	    "
r5   c                 "    d| j                    dS )Nr  r  r  r/   s    r3   __str__zKTestiLocBaseIndependent.test_iloc_setitem_custom_object.<locals>.TO.__str__  s    4::,a((r5   c                 4    | j                   |j                   k(  S r  r  )r/   others     r3   __eq__zJTestiLocBaseIndependent.test_iloc_setitem_custom_object.<locals>.TO.__eq__  s    zzU[[00r5   c                     | S r  r@   r  s    r3   rb   zHTestiLocBaseIndependent.test_iloc_setitem_custom_object.<locals>.TO.view  s    r5   )r  N)
r6   r7   r8   r  r"  r  __repr__r  r  rb   r@   r5   r3   TOr    s+    #) ) H1t 1r5   r  r   r   r}   re   r   )r	   r*   rQ   rR   r>   r   )r/   r  rV   r   s       r3   test_iloc_setitem_custom_objectz7TestiLocBaseIndependent.test_iloc_setitem_custom_object}  s    	 	 aVaS111!Q!5qED
fb) aVaS11!Q!5
fb)r5   c                    t        t        j                  j                  d      j                  d      t	        d      t	        d            }|j
                  d   }t        |t              sJ t        j                  |j                  |j                  d          |j                  j
                  d d df   }t        |t              sJ t        j                  |j                  |j                  d          y )Nr   r   ABCaabr~  r   )r	   r>   r   r   r<   r*   
isinstancer   rQ   assert_almost_equalrN   T)r/   rV   r   s      r3   !test_iloc_getitem_with_duplicatesz9TestiLocBaseIndependent.test_iloc_getitem_with_duplicates  s    II!!!$++F3Ku+
 &&)))
v}}biil;1a4&&)))
v}}biil;r5   c                     t        g dg dgg d      }|j                  d d dgf   }|j                  dgd      }t        j                  ||       y )Nr   r   )r   r   r   ro   r   r   r   )r	   r*   takerQ   rR   r2  s       r3   "test_iloc_getitem_with_duplicates2z:TestiLocBaseIndependent.test_iloc_getitem_with_duplicates2  sJ    	9-yAQC77A3Q7'
fh/r5   c                    t        t        dd      ddgi      }|j                  d   }t        t        dd      did      }t	        j
                  ||       |j                  d d df   }t        ddgt        dd            }t	        j
                  ||       |j                         }|j                  d d dfxx   dz  cc<   t        t        dd      ddgi      }t	        j                  ||       y )Nr   r   r   rA  rC   )r	   r   r*   r   rQ   r   rM   rR   r2  s       r3   test_iloc_intervalz*TestiLocBaseIndependent.test_iloc_interval  s    AA/08Aq>1-A6
vx0A1a&x1~6
vx0AqDQhq!nq!f56
fh/r5   indexing_funcrhs_funcc                 L   t        g d      } |ddg      |j                   |g d      <   t        g d      }t        j                  ||       t	        dg di      } |dgdgg      |j                   |g d      <   t	        dg di      }t        j
                  ||       y )Nr   rm   rw   TFT)rm   r   rw   r   )r   r*   rQ   r   r	   rR   )r/   r  r  rh   rX   rV   s         r3   test_loc_setitem_boolean_listz5TestiLocBaseIndependent.test_loc_setitem_boolean_list  s     Y7?B7H234*%
sH-Y'(6>bT{6K123c:./
b(+r5   c                    t        dg did      }|j                  d d d d df   }t        j                  ||       d|d<   |j                  d d d d df   }t        |d   |d   d      }t        j                  ||       y )	Nrv   r   Int64r    r   foor   )r   rv   r   )r/   rV   resrX   s       r3   .test_iloc_getitem_slice_negative_step_ea_blockzFTestiLocBaseIndependent.test_iloc_getitem_slice_negative_step_ea_block  s    Y'w7gga2g
c2&3gga2g2c7C9:
c8,r5   c                 0   t        dg did      }t        j                  dgdgg      |j                  t        j                  ddg      t        j                  dg      f<   t        dg di|d   j                        }t        j                  ||       y )	Nstatusr  r\  r    r   r   r   )r   r   r   )r	   r>   r   r*   r!   rQ   rR   r   s      r3   *test_iloc_setitem_2d_ndarray_into_ea_blockzBTestiLocBaseIndependent.test_iloc_setitem_2d_ndarray_into_ea_block  sy    /2*E3588cUSEN3K!Q "((A3-/0h88@R@RS
b(+r5   c                     t        dd      j                  }t        |d      }|j                  d   }|d   |d   k7  sJ |d   |d<   |d   |d   k(  sJ y )Nr   g      $@FrT  r   r   r   )r   _valuesr	   r*   )r/   ra   rV   rh   s       r3   *test_iloc_getitem_int_single_ea_block_viewzBTestiLocBaseIndependent.test_iloc_getitem_int_single_ea_block_view  sl     Q%--s' ggaj 1vR   RA1vR   r5   c                    t        ddgddgd      }|rOt        j                  t        d      5  t        dt	        ddg      i      |j
                  d d d	gf<   d d d        y t        dt	        ddg      i      |j
                  d d d	gf<   t        t        d
      t        d      gddgd      }t        j                  ||d       y # 1 sw Y   y xY w)Nz
2022-01-01z
2022-01-0220212022r   r   rq   rv   r   z2021-01-01 00:00:00z2022-01-01 00:00:00Fcheck_dtype)	r	   r9   r   r   r   r*   r   rQ   rR   )r/   using_infer_stringrV   rX   s       r3   )test_iloc_setitem_multicolumn_to_datetimezATestiLocBaseIndependent.test_iloc_setitem_multicolumn_to_datetime  s    lL9@PQRy@ R"+S+vv>N2O,P"QA3R R (k66:J.K(LMBGGAsFO  ""78!"78 !&)H !!"hEBR Rs   +CC)Qr6   r7   r8   __doc__r9   r:   r;   slicer,   r
   r>   asarrayrY   rc   ri   skipifr   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  filterwarningsr.  r3  r5  r7  r9  r?  rF  rN  rP  rR  rX  rZ  r_  rb  r   r   re  r   ri  rm  rv  r|  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r@   r5   r3   rB   rB   B   s0   )[[$K!H!H%(OBJJy!	

,
,< [[Yu6? 7?>1 [[%S  ccJ [[_			"tG}/M.NO[[ DkC:&3Zt%tQ"#U4[1	
	- P	-H1610&0& [[We}6P&QR S0.5: [[Yu6, 7,0 [[Yu6, 7,( [[Yu6, 7,",,8,0/0b!F!0F [[Yu6"1 7"1H [[Yu6, 7,* [[Yu6[[Y!eD!T.BHBHHaSM(RS[[Wuhbhhuo&>?3 @ T 73 [[ 56FY 7FYP0<*0"
23.*30&11* [[WtS"&&&9:1 ;1 [[XAS'AB) C)N"1, [[WtRXX&67, 8, [[Yu6[[Y!eAqk(:;- < 7- [[Yu6, 7,$#9J *D<00" [[_tRXX.>?[[Z$)9:
, ; @
,
-,!Cr5   rB   c                   `    e Zd Zd Zej
                  j                  dddg      d        Zd Zy)TestILocErrorsc                 @   |}|t         u r|j                         }d}t        j                  t        |      5  |j
                  d    d d d        t        j                  t        t              5  d|j
                  d<   d d d        y # 1 sw Y   AxY w# 1 sw Y   y xY w)Nz5Cannot index by location index with a non-integer keyrq   g      @r   )r	   rg   r9   r   r   r*   r.   _slice_iloc_msg)r/   series_with_simple_indexr0   r2   r   s        r3   test_iloc_float_raisesz%TestILocErrors.test_iloc_float_raises  s     'i',,.CE]]9C0 	HHSM	 ]]:_= 	CHHSM	 		 		 	s   B/BBBrZ   TFc                 2   t        j                  t        d      5  |j                  d d d d d d f    d d d        |r|d d  }t        j                  t        d      5  d|j                  d d d d d d f<   d d d        y # 1 sw Y   MxY w# 1 sw Y   y xY w)NzToo many indexersrq   ztoo many indices for arrayr   )r9   r   r   r*   r.   )r/   float_framerZ   rb   s       r3   *test_iloc_getitem_setitem_fancy_exceptionsz9TestILocErrors.test_iloc_getitem_setitem_fancy_exceptions!  s    ]]=0CD 	&Q1W%	& q>D]]:-IJ 	*()KQ1W%	* 	*	& 	&
	* 	*s   BBB
Bc                 D   t        dg di      }t        dg di      }d}t        j                  t        |      5  d|j                  |<   d d d        d}t        j                  t
        |      5  |j                  |    d d d        y # 1 sw Y   ?xY w# 1 sw Y   y xY w)Nr   r   r  zADataFrame indexer for .iloc is not supported. Consider using .locrq   r   zWDataFrame indexer is not allowed for .iloc
Consider using .loc for automatic alignment.)r	   r9   r   r   r*   r.   )r/   rV   r  r   s       r3   test_iloc_frame_indexerz&TestILocErrors.test_iloc_frame_indexer,  s    Y'(S"567Q]]9C0 	! BGGG	!; 	 ]]:S1 	GGG	 		! 	!	 	s   B
1B
BBN)	r6   r7   r8   r  r9   r:   r;   r  r  r@   r5   r3   r  r    s5    & [[Yu6* 7*r5   r  c                   j    e Zd Zd Zd Zd Zej                  j                  g dddg      d        Z	y)	TestILocSetItemDuplicateColumnsc                 4   t        d dddddg      }t        ddddddg      }t        ||gd      }d|j                  d<   |j                  d   dk(  sJ |j                  d	   dk(  sJ |j                  j                  d   t        j
                  k(  sJ y )
Nr   r   r   rC   r"   r   r   rH   )r   r   )r	   r   r*   dtypesr>   r
  )r/   r   r   rV   s       r3   *test_iloc_setitem_scalar_duplicate_columnszJTestILocSetItemDuplicateColumns.test_iloc_setitem_scalar_duplicate_columns=  s    t!,AA.>?@qq)+;<=S#JQ'wwt}"""wwt}!!!yy~~a BHH,,,r5   c                     t        g dgg d      }dg|j                  d d df<   t        g dgg d      }t        j                  ||       y )N)r   r"  str2r   r   r   ro   str3r   )r   r"  r  r   r   s      r3   (test_iloc_setitem_list_duplicate_columnszHTestILocSetItemDuplicateColumns.test_iloc_setitem_list_duplicate_columnsH  sE    *+_E101?K
b(+r5   c                 b   t        t        j                  dt        j                        j	                  dd      g d      }|j
                  d d df   j                  t        j                        |j
                  d d df<   |j                  j
                  d   t        j                  k(  sJ y )Nr$   r    r   r"   r   ro   r   )	r	   r>   r   r
  r   r*   rO   r?   r  )r/   rV   s     r3   *test_iloc_setitem_series_duplicate_columnszJTestILocSetItemDuplicateColumns.test_iloc_setitem_series_duplicate_columnsQ  s{    IIarxx(00A6@T
 1,,RZZ81yy~~a BHH,,,r5   )r  
init_valueexpected_value)r
  0r   )floatz1.2g333333?c                     t        |ddggg dt              }|j                  d d df   j                  |      |j                  d d df<   t        |ddggg dt              }t	        j
                  ||       y )Nr"  r  r  )rp   r!   r   )r	   r=   r*   rO   rQ   rR   )r/   r  r  r  rV   expected_dfs         r3   *test_iloc_setitem_dtypes_duplicate_columnszJTestILocSetItemDuplicateColumns.test_iloc_setitem_dtypes_duplicate_columnsX  sx     %()?&
 1,,V41eV,-#

 	b+.r5   N)
r6   r7   r8   r  r  r  r9   r:   r;   r  r@   r5   r3   r  r  <  s@    	-,- [[2	12/	/r5   r  c                       e Zd Zd Zd Zy)TestILocCallablec                    t        g dt        d      dt        d            }|j                  d    }t        j                  ||j                  ddg          |j                  d	 d d f   }t        j                  ||j                  ddgd d f          |j                  d
 d f   }t        j
                  ||j                  ddgdf          |j                  d d f   }t        j                  ||j                  ddgdgf          |j                  ddgd f   }t        j
                  ||j                  ddgdf          |j                  ddgd f   }t        j                  ||j                  ddgdgf          |j                  d df   }t        j
                  ||j                  ddgdf          |j                  d dgf   }t        j                  ||j                  ddgdgf          y )Nr\   aabbXYr   r)   c                 
    ddgS Nr   rC   r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_getitem_callable.<locals>.<lambda>v  
    A r5   r   rC   c                 
    ddgS r  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_getitem_callable.<locals>.<lambda>y  r  r5   c                 
    ddgS r  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_getitem_callable.<locals>.<lambda>|  r  r5   c                      yNr   r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_getitem_callable.<locals>.<lambda>|      r5   r   c                 
    ddgS r  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_getitem_callable.<locals>.<lambda>  r  r5   c                     dgS r  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_getitem_callable.<locals>.<lambda>  s    1# r5   c                      yr  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_getitem_callable.<locals>.<lambda>  r  r5   c                     dgS r  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_getitem_callable.<locals>.<lambda>  s     r5   c                 
    ddgS r  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_getitem_callable.<locals>.<lambda>  r  r5   c                 
    ddgS r  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_getitem_callable.<locals>.<lambda>  r  r5   )r	   r<   r*   rQ   rR   r   )r/   rV   r  s      r3    test_frame_iloc_getitem_callablez1TestILocCallable.test_frame_iloc_getitem_callableq  s   \V=T&\R gg&'
c277Aq6?3gg&)*
c277Aq619#56gg&34
sBGGQFAI$67gg&56
c277Aq6A3;#78 ggq!fk)*
sBGGQFAI$67ggq!fm+,
c277Aq6A3;#78gg&)*
sBGGQFAI$67gg&+,
c277Aq6A3;#78r5   c                 6   t        g dt        t        d      t              dt        d            }|j	                         }d|j
                  d <   |j	                         }d|j
                  d	d
g<   t        j                  ||       |j	                         }d|j
                  d d d f<   |j	                         }d|j
                  d	d
gd d f<   t        j                  ||       |j	                         }d|j
                  d d f<   |j	                         }d|j
                  d	d
gdf<   t        j                  ||       |j	                         }d|j
                  d d f<   |j	                         }d|j
                  d	d
gdgf<   t        j                  ||       |j	                         }d|j
                  d	d
gd f<   |j	                         }d|j
                  d	d
gdf<   t        j                  ||       |j	                         }d|j
                  d	d
gd f<   |j	                         }d|j
                  d	d
gdgf<   t        j                  ||       |j	                         }d|j
                  d df<   |j	                         }d|j
                  d	d
gdf<   t        j                  ||       |j	                         }ddg|j
                  d dgf<   |j	                         }ddg|j
                  d	d
gdgf<   t        j                  ||       y )Nr\   r  r    r  r   r)   r   c                 
    ddgS r  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_setitem_callable.<locals>.<lambda>  
    Aq6 r5   r   rC   r   c                 
    ddgS r  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_setitem_callable.<locals>.<lambda>  r  r5   rm   c                 
    ddgS r  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_setitem_callable.<locals>.<lambda>  r  r5   c                      yr  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_setitem_callable.<locals>.<lambda>  r  r5      c                 
    ddgS r  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_setitem_callable.<locals>.<lambda>  r  r5   c                     dgS r  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_setitem_callable.<locals>.<lambda>  s    aS r5   r   c                      yr  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_setitem_callable.<locals>.<lambda>  r  r5   c                     dgS r  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_setitem_callable.<locals>.<lambda>  s    A3 r5   rw   c                 
    ddgS r  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_setitem_callable.<locals>.<lambda>  r  r5   c                 
    ddgS r  r@   r   s    r3   r   zCTestILocCallable.test_frame_iloc_setitem_callable.<locals>.<lambda>  r  r5   )r	   r   r<   r=   rM   r*   rQ   rR   )r/   rV   r  r   s       r3    test_frame_iloc_setitem_callablez1TestILocCallable.test_frame_iloc_setitem_callable  s   VDL%GHv,
 ggi%&!"ggi!Q
c3'ggi(*!1$%ggi !Q
c3'ggi23!;./ggi!Q
c3'ggi46!=01ggi "!Q!
c3' ggi(*!Q$%ggi !Q
c3'ggi*,!Q&'ggi "!Q!
c3'ggi(*!1$%ggi !Q
c3'ggi+-r(!A3&'ggi!#R!Q!
c3'r5   N)r6   r7   r8   r  r  r@   r5   r3   r  r  p  s    9<7(r5   r  c                   Z    e Zd Zd Zd Zd Zd Zd Z ej                  d      d        Z
y)	TestILocSeriesc           
         t        t        j                  j                  d      j	                  d      t        t        ddd                  }|j                         }t        t        |            D ]9  }|j                  |   }||j                  |      }t        j                  ||       ; |j                  t        dd         }|j                  dd }t        j                  ||       t        j                   d       5  d|d d  d d d        t        j                  ||       |j                  g d	   }|j#                  |j                  g d	         }t        j                  ||       y # 1 sw Y   gxY w)
Nr   rw   r   rl   r)   r   rC   r"   )r   r   rC   r"   rm   )r   r>   r   r   r   r<   r,   rM   r-   r*   r   rQ   r  r  r   r   assert_produces_warningreindex)r/   rh   ser_originalrE  r   r   rX   s          r3   	test_iloczTestILocSeries.test_iloc  s8   II!!!$44R8U1bRS_@U
 xxzs3x 	0AXXa[Fciil#C""63/	0 %1+&771Q<
vx0 ''- 	F1I	 	sL1 /*;;syy9:
vx0	 	s   E--E6c                 N    t        g dg d      }|j                  d   dk(  sJ y )Nr   r   r)   r   )r   r*   )r/   rh   s     r3   test_iloc_getitem_nonuniquez*TestILocSeries.test_iloc_getitem_nonunique  s$    Yi0xx{ar5   c                     t        g d      }t        g dg d      }|j                  dd |j                  dd t        g d      }t        j                  ||       y )Nr   r   )r   r   r   r)   r   rC   )r   rm   r~   )r   r*   rQ   r   )r/   ser1ser2rX   s       r3   r  z4TestILocSeries.test_iloc_setitem_pure_position_based  sK    i iy11Q		!A)$
tX.r5   c                     t        dgt        j                  gd      }t        t        gdd      }t        j                  t        d      5  ||j                  d d df<   d d d        y # 1 sw Y   y xY w)Ntest)r   r   r   r  )r   r!   r   rq   )	r	   r>   r   r   r   r9   r   r   r   )r/   r   rh   s      r3   #test_iloc_nullable_int64_size_1_nanz2TestILocSeries.test_iloc_nullable_int64_size_1_nan  s^    &9:bT73]]9O< 	%!$FJJq#v	% 	% 	%s   A**A3c                 *   t        j                  d       t        ddgddgddgd      }t        ddgddgddgd      j                  d      }|j                  d d |d   f   }|j                  d d |d   f   }t        j                  ||d	
       y )Npyarrowr   r   r   r   r   )r   r   r   )dtype_backendFr  )r9   importorskipr	   convert_dtypesr*   rQ   rR   )r/   rV   df_arrowrX   r   s        r3   test_iloc_arrow_extension_arrayz.TestILocSeries.test_iloc_arrow_extension_array  s    I&aV1a&SzBCa&1vS#J7

.y.
1 	 771bg:&q(3-/0
fhEBr5   r!  c                     t        g dd      }t        ddg      }t        ddgd      }||j                  |<   t        g dd      }t        j                  ||       y )	Nr   zint64[pyarrow]r    r   r   r   r$   )r   r$   rC   )r   r
   r*   rQ   r   )r/   rh   r'  valsrX   s        r3   test_setitem_pyarrow_int_seriesz.TestILocSeries.test_setitem_pyarrow_int_series  sY     Y&67QFmq!f$45)+;<
sH-r5   N)r6   r7   r8   r  r  r  r  r&  td
skip_if_nor)  r@   r5   r3   r  r    s;    16 /%	C R]]9	. 	.r5   r  )-r  r   renumpyr>   r9   pandas.compatr   pandas.errorsr   pandas.util._test_decoratorsutil_test_decoratorsr*  pandasr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   pandas._testing_testingrQ   pandas.api.typesr   pandas.tests.indexing.commonr   escaper  r   rB   r  r  r  r  r@   r5   r3   <module>r9     s    .  	   . ' ) )    "  & K "))6
 
2FC FCR&. .b1/ 1/hV( V(rE. E.r5   