gL iNdZddlmZddlZddlZddlZddlmZddlm cm Z ddl m Z mZmZmZmZmZmZmZmZmZmZmZmZmZmZddlmZddlm Z ddl!m"Z"ejFdZ$Gd d Z%Gd d Z&Gd dZ'GddZ(GddZ)GddZ*y)z* test positional based indexing with iloc )datetimeN) IndexingError)NA CategoricalCategoricalDtype DataFrameIndexIntervalNaTSeries Timestamparrayconcat date_rangeinterval_rangeisna to_datetime) is_scalar)"check_indexing_smoketest_or_raiseszuonly integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indicesceZdZejj dddgdgejj dddgejj dgd d Zy ) TestiLockeyrrkindseriesframecol)labelsmixedtsfloatsemptycV|j|d|}t|d|ty)N_iloc)fails)getfixturevaluer IndexError)selfrrr requestobjs e/mnt/ssd/data/python-lab/Trading/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)s2%%auo6*     N)__name__ __module__ __qualname__pytestmark parametrizer0r1r/rr(sg [[UQI$67 [[Vh%89 [[ 4 :8  r1rc eZdZdZej j dedededgde ede jgdgej j de je jgdZej j!dej j d d d gej j d eegd ZdZdZej j de j,dedfgej j dedddggddgedfedddgedfgdZdZdZdZdZdZd Zej j d!d d ggd"gd#Z d$Z!d%Z"ej j!dej j d d d gd&Z#ej j!dej j d d d gd'Z$ej j!dej j d d d gd(Z%d)Z&d*Z'd+Z(d,Z)d-Z*d.Z+ej j!dej j d d d gd/Z,ej j!dej j d d d gd0Z-ej j!dej j d d d gej j dd1geddde j"d1ggej j d2d3ge j"d3ggd4Z.ej j!d5d6Z/d7Z0d8Z1d9Z2d:Z3d;Z4d<Z5d=Z6d>Z7d?Z8ej j d2de9e jtgd@Z;ej j dAeej j de je jgdFZ?dGZ@dHZAej j dIee j"gdJZBej j!dej j d d d gej j ddgeddKgdLZCej j!dej j d d d gdMZDdNZEdOZFdPZGdQZHdRZIej j dSee j"gej j dTee j"gdUZJdVZKdWZLeMjdXZOdYZPy)ZTestiLocBaseIndependentzTests Independent Of Base ClassrNrindexerc(tdtdit}tgd}|s*|jj dj |sJ|j}|j}||||df<td|ijt}|s%tj|dj|sJtj||d|jd<|ddk7sJttjgdttdd}|j}||||df<tt!|jtttdd}tj||y) Nrr;dtype)alphabetagammarBrrrrr)rrangeobjectr_mgrblocks_can_hold_elementcopyvaluesastypenp shares_memorytmassert_frame_equalr(rr ) r,r<rusing_array_managerrcatdf orig_valsexpecteds r/%test_iloc_setitem_fullcol_categoricalz=TestiLocBaseIndependent.test_iloc_setitem_fullcol_categorical?sK1eAh-v645"::$$Q'99#> >> ZZ\II ! CFaX&--f5"##BqELL)< << b(+  1v   bhhy?E!HMN ZZ\! CF 6(:&!IeTUhWX b(+r1.ignore:Setting a value on a view:FutureWarninghas_refTFboxctgd}||jd}|r|dd}|tur |j}n|jj d}|tur||dd|j ddn||dd|j dddf<|tjgdd} tj|| |st|turF|r2|j|usJtj|j|sJ|j|usJyytj|dj|sJyy)Nrrr;i8rr)r;r\r;r\r>) rto_numpyr rKrGarraysr(rMrO assert_equalrN) r,frame_or_seriesrYrXusing_copy_on_writearrr.viewrKrUs r/test_iloc_setitem_ea_inplacez4TestiLocBaseIndependent.test_iloc_setitem_ea_inplaceks,L!cll401 q6D f $ZZFXX__Q'F f $s12w>>r1ctgd}ttd|}|jj dsJ|j }|jj dsJy)N)rrrr;index)rrr)r r rEr(_is_scalar_accessto_frame)r,rhserrSs r/test_is_scalar_accessz-TestiLocBaseIndependent.test_is_scalar_accesssWi U1XU+xx))$/// \\^ww((000r1c (ttjjdjdt d}d}t j t|5|jddgdfdddt j t|5|jdd gdddt j t|5|jdd gdddt j t|5|jd gddd|d }t j t|5|jd gdddt j t|5|jd gdddd}t j t|5|jd dddt j t|5|jd dddt j t|5|jd dddt j t|5|jd ddd|jddddf}|jddddf}tj|||jddddf}|jddddf}tj|||jdddddf}|jdddddf}tj|||jdddddf}|jdddddf}tj|||jddddf}|jddddf}tj|||jddddf}|jddddf}tj|||jdddddf}|jddddf}tj|||jddddf}|jddddf}tj|||jdd }|jdd}tj|||jd d}|jdd}tj|||jd dd}|jddd}tj||ttjjdjdt d}tj|jddddft|jtg|jj tj|jddddf|jdddgftj|jdd|jdgd}t j t|5|jgddddd}t j t|5|jdddfdddy#1swYxYw#1swYxYw#1swYxYw#1swYxYw#1swYcxYw#1swYrhrsr\rpr)rrMrandom default_rnglistr5raisesr+r(rOrPassert_series_equalstandard_normalrhr rsr?)r,rSmsgsresultrUdfls r/test_iloc_exceeds_boundsz0TestiLocBaseIndependent.test_iloc_exceeds_boundssryy,,Q/66w?g W6 ]]:S 1 + GGA)) * + ]]:S 1  GGQG   ]]:S 1  GGQH   ]]: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/BqG$771eqe8$ fh/Ac"H%771aee8$ fh/CE"771bqb5> fh/BqD!771bqb5> fh/CBJ'771bqb5> fh/BrE"771bqb5> fh/266"#; vx066"1: vx0B66$B$< vx0 II ! !! $ 4 4V ?@qq)+;<= S#JQ 'F||A2661a+3GaP vx0r1ctdddddddddd d dg}tddddg}tj|jd g|tddddddddg}tj|jd dg|tddd d d d gd dg }|jd dgddgf}tj||y)Nrrr;rrx, r)rrrg)rrOrPr(r,rSrUrs r/test_iloc_getitem_arrayz/TestiLocBaseIndependent.test_iloc_getitem_arrayRs aa(#.D1  AAA678 bggqclH5AAA6cRU8VWX bggq!fox8AA.d0FGPQSTvV!Q!Q( fh/r1c.tdddddddddd d dg}tddddddddg}|jgd }tj||tdddddd d dgd dg }|jd}tj||y)Nrrr;rrxrrrrr)TTFrrgc&|jdzdk(S)Nrrrgxs r/z@TestiLocBaseIndependent.test_iloc_getitem_bool..us177Q;!#3r1rr(rOrPrs r/test_iloc_getitem_boolz.TestiLocBaseIndependent.test_iloc_getitem_booles aa(#.D1  AAA6cRU8VWX,- fh/11 %T4'H IRSUVQW 34 fh/r1rh)TFTFctgd}dt|dt|}tjt|5|j |dddy#1swYyxYw)Nrz Boolean index has wrong length: z instead of rt)r rr5rr+r()r,rhrrs r/test_iloc_getitem_bool_diff_lenz7TestiLocBaseIndependent.test_iloc_getitem_bool_diff_lenxsV 9 0U LQQ ]]:S 1  FF5M   s AA%ctdddddddddd d dg}tddddddddg}|jdd}tj||tddd gdg }|jddd df}tj||tdddddddd dg}|jdddf}tj||y)Nrrr;rrxrrrrrrrgr)ryrc ddgS)Nrrr8)rSs r/rzATestiLocBaseIndependent.test_iloc_getitem_slice..s 1vr1rrs r/test_iloc_getitem_slicez/TestiLocBaseIndependent.test_iloc_getitem_slices aa(#.D1  AAA6cRU8VWX! fh/Cc23A3?1ac" fh/1 Ss34d5K L --. fh/r1cttjjdj dgd}ttjjdj dddj ddd d g}t||gd }tj|jdddd f|tj|jddd df|t||gd }tj|jddddf|tj|jddddf|t||jdddgfgd }tj|jddddf|t||gd }tj|jddddf|tj|jddddf|tj|jddddf|tj|jddddf|y)Nrrzr\)ryryrrrrrrzrosizeryrrrr\r;) rrMrrrintegersrrrOrPr()r,rrrSexps r/test_iloc_getitem_slice_dupsz4TestiLocBaseIndependent.test_iloc_getitem_slice_dupss II ! !! $ 4 4W =(  II ! !! $ - -a" - = E Eb! L#J  S#JQ ' bgga!enc2 bggaenc2 S#JQ ' bgga!enc2 bggaenc2c388AsF+,15 bgga1fos3RH1 % bggadBQBh/5 bggadABh/5 bggbc2A2g.4 bggbc12g.4r1c jttjjdj dtj dddtj ddd}|r|dd}d|j d <|j d }|dk(sJd|j ddddf<|j ddddf}|j ddddf}tj||tdgd  }|j ddxxxdz ccctgd gd  }tj||y) Nrr\r\r r;rrrrrrgrrr) rrMrrrrr(rOrPr r)r,warn_copy_on_writerXrSrdrrUrs r/test_iloc_setitemz)TestiLocBaseIndependent.test_iloc_setitems  II ! !! $ 4 4V <))Aq!$IIaQ'  a5D {{1Q3771ac6?AaC fh/ 1I & q q )95 q(+r1cDtgdgdgdg}|djt|d<|r|dd}tgdgdgdg}|djt|d<d|jdd <t j ||tgdgdgdg}|djt|d<|r|dd}tgd gd gd g}|djt|d<d|jdd <t j ||y) N)rcrz)rdr|)rerr)rprprprprrr)rrrp)rrrp)rrrp)rrLrFr(rOrPr,rXrSrdrUs r/test_iloc_setitem_axis_argumentz7TestiLocBaseIndependent.test_iloc_setitem_axis_arguments lLA B1 V$1 a5DlL)DEqk((0 Q b(+  lLA B1 V$1 a5Dk; DEqk((0 Q b(+r1cvttjdjdgdgd}|r|dd}|jddgddgf|jddgddgfxxdz cc<ttj gd jdgdgd}t j||y) N r;r;rrrrrrx) rrrr;rrrrr)rrMrrr(rrOrPrs r/test_iloc_setitem_listz.TestiLocBaseIndependent.test_iloc_setitem_lists IIaL  (  a5D AA AA3& HH8 9 A A& I!#  b(+r1c@tgd}tgd}|j}ddg|jtddg<tj|||j}ddg|jt ddg<tj||y)N)rrrr;)rrr;rrrr)r rJr(rOrr )r,s_origrUrs r/test_iloc_setitem_pandas_objectz7TestiLocBaseIndependent.test_iloc_setitem_pandas_objects %.) KKM"$bvq!f~ q(+ KKM!#RuaV} q(+r1cVtddddddg}tddddddg}t||gd}|jd}tj|j dddf}||j }|j |df|j |df<tj||tddgddgd}d d g|_ |d =tj|||j ddgddgf|j ddgddgf<tj|||j ddgddgfjd |j ddgddgf<|j ddgddgfjd |j ddgddgf<tj||y) Nrrrr;r\rrrDrryT)drop) rrfillnarMisnanr(rhrOrPrs reset_index)r,rrrSrUindsmasks r/test_iloc_setitem_dupsz.TestiLocBaseIndependent.test_iloc_setitem_dupsst!,AA.>?@qq)+;<= S#JQ '99Q<xx1 &Dz7747+a b(+!QQF34: sG b(+#%''1a&1a&."9AA b(+#%''1a&1a&."9"E"E4"E"PAA"$''1a&1a&."9"E"E4"E"PAA b(+r1cvtddgddggddg}|jdddfjd|jdddf<|s$t|jj dk(sJt jtd 5|jdddfd z|jdddf<ddd|s$t|jj dk(sJ|j}|jddgddgf|jddgddgf<t j||y#1swY~xYw) Nrrrr;rrrf8incompatible dtypertg?) rr(rLrrGrHrOassert_produces_warning FutureWarningrJrP)r,rQrSrUs r/9test_iloc_setitem_frame_duplicate_columns_multiple_blockszQTestiLocBaseIndependent.test_iloc_setitem_frame_duplicate_columns_multiple_blocks s AA'#s <1 ,,T21 "rww~~&!+ ++ ' ' =Q R 0GGAqDMC/BGGAqDM 0"rww~~&!+ ++779#%''1a&1a&."9AA b(+ 0 0s (D//D8c ttjjdj dt dddt ddd}|j d}|jd}tj|||j d}|jd }||k(sJ|j dd}|jdd }tj|||j dddd f}|jdddd f}tj|||j gd }|jgd}tj|||j gd ddgf}|jgdddgf}tj|||j gdddgf}|jgdddgf}tj|||j gdddgf}|jgdddgf}tj||tt dd t}|j |j}|jgd}tj||y)Nrrrrorrr\)rrrr;rp)rrr;)rrrr)rrr;r)r}rrr)rrrr;)r}r}rr)rhr?)rr\rr)rrMrrrrEr(locrOrrPr rFrh)r,rSrrrUrs r/test_iloc_getitem_framez/TestiLocBaseIndependent.test_iloc_getitem_frame=s+  II ! !! $ 4 4W =2q/!QN  ffQi vs+ffTl}}166!B< fh/AaC66!QqS&> fh/#66)$ fh/QF*+66)aV+, fh/b!W,-66*q!f,- fh/"a0166.1a&01 fh/ q!F 3!66,' fh/r1cttjjdj dt dt d}|j d}|jd}||k(sJ|j ddddf}|jddd gf}tj|||j d }|jd }||k(sJd }tjt| 5|j ddddd}tjt| 5|j d dddy#1swY?xYw#1swYyxYw)Nrr abcdefghijABCDrr)brr;r)rr)jrzCindex 5 is out of bounds for axis 0 with size 4|index out of boundsrt)rzrpzLocation based indexing can only have \[integer, integer slice \(START point is INCLUDED, END point is EXCLUDED\), listlike of integers, boolean array\] types)rrMrrrrr(rrOrPr5rr+ ValueError)r,rSrrrUrs r/ test_iloc_getitem_labelled_framez8TestiLocBaseIndependent.test_iloc_getitem_labelled_framens9  II ! !! $ 4 4W =|$L  ffX}}AaC66!cU(# fh/ffX}}T ]]:S 1  GGEN   ; ]]:S 1  GGH       s3E(E E  Ectjjdjd}t dd}t d}t |||}|j|jdd d df}t |dd d df|dd |d d}tj||t d |_ |jdd d df}t |dd d df|dd t d }tj||tjjdjd}t td d d}t td dd}t |||}|s#|jjd j|jdd ddf}t |dd ddf|dd |dd}tj||y)Nr)rr\20130101r)periodsrrr;rpraaaaaarrrr\)rMrrrrrrdescriber(rOrPrsrErGrHmgr_locs)r,rQrcrhrsrSrrUs r/test_iloc_getitem_doc_issuez3TestiLocBaseIndependent.test_iloc_getitem_doc_issuesii##A&66v>:q1v, s% 9 1ac"S1ac]%!*gaPQlS fh/&\ 1ac"S1ac]%!*d4jQ fh/ii##A&66v>U1b!_%uQ1~& s% 9" GGNN1  & &1ac"S1ac]%!*gaPQlS fh/r1cttjjdj dt dt d}|r|dd}d|j d<|j d}|dk(sJd|j dddd f<|j dddd f}|j dddd f}tj||ttjjdj d tdd d }d|j d<|j d}|dk(sJd|j dd |j dd }|j dd }tj||tdgdz}gd|j ddd<gd|j ddd<|}tgd}tj||y)Nrrrrrrrrr;rzrorgr\rr)rrr\)rr;rprv) rrMrrrrr(rOrPr rEr)r,rXrSrdrrUrs r/test_iloc_setitem_seriesz0TestiLocBaseIndependent.test_iloc_setitem_seriess II ! !! $ 4 4W =|$L  a5D {{1Q3771ac6?AaC fh/ 299((+;;B?uQPRTU Wq {{r 66"1: vx0 B4!8  qt!t  qt!t ,- vx0r1cttjddtjdddd}|r|dd}ddgddgg|jd d tgd gd d}t j ||tgd tjdddd}|r|dd}ddgddgg|jd d tgdgd d}t j ||y)Nrpint64r>rzrr|rrrr\)rrrzrr\)rprr|rrrrrrrry)rrrrr)rrMrr(rOrPrs r/test_iloc_setitem_list_of_listsz7TestiLocBaseIndependent.test_iloc_setitem_list_of_listss ))AW-BIIa74S T  a5DR2r(+! #4;LMN b(+ +"))Ar2Q R  a5Db C9-! #r\)locsnums0b11000b11ztUnalignable boolean Series provided as indexer (index of the boolean Series and of the indexed object do not match).) )N)N.loc)N.iloc)rhr)rhr )rhr!)rr)rr )rr!)Nrhrr)rr r!rr[z] does not match [z ], received [])rrrErr5rrr(rrhNotImplementedErrorrMrboolrOrPrbinrrKgetattrr strsumrgetAssertionError)r,rSrrrrrnumrepsrUidx mask_indexmethodaccessoranswererrrrs r/test_iloc_maskz&TestiLocBaseIndependent.test_iloc_masksYtE!H~T']SE Jttax1}R ]]:S 1  GGDM 3t9% T ]].c :  GGDM 4&3t9"4DAB fb)yy|$w$()SC)) d3T :!$%!%T$,0! ,+ CGGaK''D$R-dd3 dD$45/ &#*2vabz#:#% Xd^F%;%?%?%A!BCF LL%;(C5 26(-s!L!   O    *J#M3FG& XF&s6H(H")H/% :  GGCL   s <CCc Tttjdtt dDcgc]}d| c}dtt dDcgc]}d| c}d}t j |jddgf|jddddfd d t j |jgddf|jddddfd d t j |jg|jddddfd d ycc}wcc}w) Nr~rpzi-rrrrrT)check_index_typecheck_column_type)rrMonesr rErOrPr()r,irSs r/"test_iloc_empty_list_indexer_is_okz:TestiLocBaseIndependent.test_iloc_empty_list_indexer_is_ok[s  GGFO584a2aS43?U1X6Rs86SA   GGArEN GGArrEN!"    GGBEN GGBQBEN!"    GGBK!Q$RV %56s D  D%cntdgdi}|jdd}||usJtj|d|dsJt j |5gd|j dddf<ddd|r|dgdk(jsJ|ddk(jsJtgd}|jdd}||usJt j |5gd|ddddd|rt|ddgdk(sJyt|ddgdk(sJy#1swYxYw#1swYCxYw)Nrr)r\r\r\r\)rrr;r\rprrrrr;) rr(rMrNrOassert_cow_warningrallr )r,rbr original_df sliced_dforiginal_series sliced_seriess r/&test_identity_slice_returns_new_objectz>TestiLocBaseIndependent.test_identity_slice_returns_new_objecttsU i 01 $$Q'  +++ C 0)C.AAA " "#5 6 0&/KOOAsF # 0 cNi/446 66cNa',,. .. !34',,Q/ O333 " "#5 6 ,"+OBQ  , }Ra(I56 66}Ra(I56 66% 0 0 , ,sD!D+D(+D4ctddgddgg}|jtjd}t ddgd}t j ||y)Nrrr;r\rr=)rr(rMrr rOr)r,rSrrs r/test_indexing_zerodim_np_arrayz6TestiLocBaseIndependent.test_indexing_zerodim_np_arraysO AA' (!% Aq6 " vq)r1cptddg}|jtjd}|dk(sJy)Nrrr)r r(rMr)r,rrs r/%test_series_indexing_zerodim_np_arrayz=TestiLocBaseIndependent.test_series_indexing_zerodim_np_arrays1 Aq6N ${{r1c.tgd}t|gddd}tj|d|sJ|ddd|jdddf<tj|d|sJtgd gd }tj ||y) Nrr)rrF)rJrrr)rrry categories)rrrOrNr(assert_categorical_equal)r,rRrSrUs r/-test_iloc_setitem_categorical_updates_inplacezETestiLocBaseIndependent.test_iloc_setitem_categorical_updates_inplaces/* 39-E :1s+++DbD 1 1s+++?K ##C2r1ctddgddgddgdtjgg}|j|jdkxxdzcc<tddgddgdd gdtjgg}t j |||j|jdkDxxdzcc<tddgddgdd gd tjgg}t j |||jgd xxdzcc<tddgdd gdd gd tjgg}t j |||jgd xxdzcc<tdd gddgddgdtjgg}t j ||y)Nrrrr;r\rprrrzr)TTFF)FFTTg@g(@g@)rrMrr(rhrOrPr,rrUs r/ test_iloc_with_boolean_operationz8TestiLocBaseIndependent.test_iloc_with_boolean_operationsiQFQFQFQK@A FLLA%&!+&q!fq!fq"g266{CD fh/ FLL1$%*%q!fq!fq"gBFF|DE fh/ ./14/q!fq"g2wRVV EF fh/ ./14/q#hD As8a[IJ fh/r1ctdtdji}|jd}tdggd}t |dgdd}t j ||y) Nrz a b c d errrrQcategory)rhrr?)rrsplitr(r rOr)r,rSrraw_catrUs r/?test_iloc_getitem_singlerow_slice_categoricaldtype_gives_serieszWTestiLocBaseIndependent.test_iloc_getitem_singlerow_slice_categoricaldtype_gives_seriess] [):):)<=> ?se0IJ'#QjI vx0r1c tgdjd}|jdd}tddgjtgd}t j |||jddg}tddgjtgd}t j |||jgd}tdgjtgd}t j ||y)NrrYrrrTFF)r rLr(rrOr)r,rlrrUs r/$test_iloc_getitem_categorical_valuesz(()9))DE vx01a&!1a&>(()9))DE vx0./1#;%%&6y&AB vx0r1ctgdd}||jd<ttddgd}tj||y)Nrztimedelta64[ns]r>rrr)r r(r rOr)r,rrrUs r/%test_iloc_setitem_td64_values_cast_naz=TestiLocBaseIndependent.test_iloc_setitem_td64_values_cast_nasA ):; A31+->? vx0r1not_narg?ct|g}t||||g|}|||g|jddt||||g|}tj||y)NrQr>r;)rr r(rOr)r,rb nulls_fixturer?rlrs r/$test_setitem_mix_of_nan_and_intervalz rtr) r rrMrrrrrndimr5rrr()r,r.r.nd3rs r/4test_iloc_setitem_empty_frame_raises_with_3d_ndarrayzLTestiLocBaseIndependent.test_iloc_setitem_empty_frame_raises_with_3d_ndarraysBi II ! !! $ 4 4c#hC5I J  ii##A&// /B.sxxj9 ]]:S 1 CHHSM   s 4C  Cctjd}t|}tjd}|jdt|}t j ||gd||gdt j ||dg||dgt j ||d||dt j ||dd||ddy)NrzF)writerrr;)rMeyersetflagsrOrPr)r,r<rw_arrayrw_dfro_arrayro_dfs r/"test_iloc_getitem_read_only_valuesz:TestiLocBaseIndependent.test_iloc_getitem_read_only_valuess66":(#66":&(# genY7 9RS genaS175>1#3FG wu~a0'%.2CD genQq175>!A3FGr1c|tdtjddi}tjgd}d|j_|j |}|jgd}tj|||dj |}|djgd}tj||y)Ndatarxfloat64r>)rr;rF) rrMr@rflags writeabler(rrOrPr)r,rSindicesrrUs r/test_iloc_getitem_readonly_keyz6TestiLocBaseIndependent.test_iloc_getitem_readonly_keys 9 => ?((9%"' !66)$ fh/F)f:>>), vx0r1ctdgdg}tgd|jd<tdtgdgidgdg}tj||y)NrrrsrhrrC)rr r(rOrPr,rSrUs r/"test_iloc_assign_series_to_df_cellz:TestiLocBaseIndependent.test_iloc_assign_series_to_df_cell sS uQC 0y) cF9$5#67#qcR b(+r1klassctgdgdd}|gd}|j|dfdz|j|df<tgdgdd}tj||y)N)rrz)rr;r\)flagrr^rr)rr;r\r)r,r~rSr<rUs r/test_iloc_setitem_bool_indexerz6TestiLocBaseIndependent.test_iloc_setitem_bool_indexer'sa)D E,- gggqj1A5 o JK b(+r1rctgdgdd}tgdgdgdd}|r|dd}|jdddgf|jdd|f<tgdgdgdd}tj||y) N)r|rr)r)a2b2rrrDrrrrr)r,r<rXrrrdrUs r/%test_iloc_setitem_pure_position_basedz=TestiLocBaseIndependent.test_iloc_setitem_pure_position_based0sr |<@AiiiHI q6D"xxA3/G9.TOreturnNc||_yNr)r,rs r/__init__zLTestiLocBaseIndependent.test_iloc_setitem_custom_object..TO.__init__ys " r1c"d|jdS)Nr"r#rr,s r/__str__zKTestiLocBaseIndependent.test_iloc_setitem_custom_object..TO.__str__|s4::,a((r1c4|j|jk(Srr)r,others r/__eq__zJTestiLocBaseIndependent.test_iloc_setitem_custom_object..TO.__eq__szzU[[00r1c|Srr8rs r/rdzHTestiLocBaseIndependent.test_iloc_setitem_custom_object..TO.views r1)rN) r2r3r4rr(r__repr__r%rrdr8r1r/TOrxs+ # ) )H 1t 1 r1rrrrrir)rr(rOrPrMr)r,rrSrs r/test_iloc_setitem_custom_objectz7TestiLocBaseIndependent.test_iloc_setitem_custom_objectvs  aVaS 11 1 !Q!5qE D fb)aVaS 11  !Q!5 fb)r1cttjjdjdt dt d}|j d}t |tsJtj|j|jd|jj dddf}t |tsJtj|j|jdy)NrrABCaabr{r) rrMrrrr( isinstancer rOassert_almost_equalrKT)r,rSrs r/!test_iloc_getitem_with_duplicatesz9TestiLocBaseIndependent.test_iloc_getitem_with_duplicatess  II ! !! $ + +F 3Ku+  &&))) v}}biil;1a4&&))) v}}biil;r1ctgdgdggd}|jdddgf}|jdgd}tj||y)Nrr)rrrrrrrr)rr(takerOrPr,rSrrUs r/"test_iloc_getitem_with_duplicates2z:TestiLocBaseIndependent.test_iloc_getitem_with_duplicates2sJ  9-y AQC77A3Q7' fh/r1cttddddgi}|jd}ttdddid}t j |||jdddf}tddgtdd}t j |||j }|jdddfxxdz cc<ttddddgi}t j||y)Nrrrr=r;)rr r(r rOrrJrPrs r/test_iloc_intervalz*TestiLocBaseIndependent.test_iloc_intervals AA/ 08Aq>1-A6 vx0A1a&x1~6 vx0 AqDQhq!nq!f56 fh/r1 indexing_funcrhs_funccLtgd}|ddg|j|gd<tgd}tj||t dgdi}|dgdgg|j|gd<t dgdi}tj ||y)NrrprzTFT)rprrzr)r r(rOrrrP)r,rrrlrUrSs r/test_loc_setitem_boolean_listz5TestiLocBaseIndependent.test_loc_setitem_boolean_listsY7?B7H234*% sH- Y' (6>bT{6K 123c:./ b(+r1ctdgdid}|jdddddf}tj||d|d<|jdddddf}t|d|dd}tj||y) NryrInt64r>rfoor)rryr)r,rSresrUs r/.test_iloc_getitem_slice_negative_step_ea_blockzFTestiLocBaseIndependent.test_iloc_getitem_slice_negative_step_ea_blocks Y'w 7gga2g c2&3gga2g2c7C9: c8,r1c0tdgdid}tjdgdgg|jtjddgtjdgf<tdgdi|dj}t j ||y) NstatusrrYr>rrr)rrr)rrMrr(r?rOrPr|s r/*test_iloc_setitem_2d_ndarray_into_ea_blockzBTestiLocBaseIndependent.test_iloc_setitem_2d_ndarray_into_ea_blocksy /2* E3588cUSEN3K!Q "((A3-/0h88 @R@RS b(+r1ctddj}t|}|jd}|d|dk7sJ|d|d<|d|dk(sJy)Nrg$@rrr)r_valuesrr()r,rcrSrls r/*test_iloc_getitem_int_single_ea_block_viewzBTestiLocBaseIndependent.test_iloc_getitem_int_single_ea_block_viewsiQ%-- s^ggaj1vR   RA1vR   r1ctddgddgd}|rOtjtd5tdt ddgi|j ddd gf<dddytdt ddgi|j ddd gf<tt d t d gddgd}tj||d y#1swYyxYw)Nz 2022-01-01z 2022-01-0220212022rz%Setting an item of incompatible dtypertryrz2021-01-01 00:00:00z2022-01-01 00:00:00F) check_dtype)rrOrrrr(r rP)r,using_infer_stringrSrUs r/)test_iloc_setitem_multicolumn_to_datetimezATestiLocBaseIndependent.test_iloc_setitem_multicolumn_to_datetimes lL9@PQ R ++%L R#,S+vv>N2O,P"QA3 R R (k66:J.K(LMBGGAsFO ""78!"78!&) H  ! !"hE B R Rs +C  C)Qr2r3r4__doc__r5r6r7slicerEr rMasarrayrOrr(rVfilterwarningsrr rermrrrrrrrrrrrrrrrrrrrrrrrrrrr5r;rBrKrMrOrTrWr\r_r rrar rerirrryr}rrrrrrrrrrrtd&skip_array_manager_not_yet_implementedrrr8r1r/r:r:<s\) [[ $K !H !H  %(O BJJy !    [[Y(9:,; ,@ [[ PQ [[Yu 6 [[UUFO4 ?57R ?D1cJ [[_  " tG}/M.NO [[ DkC: &3Zt %tQ" #U4[ 1  -P - H16 10&0& [[We}6P&QRS0.5: [[ PQ [[Yu 6,7R,0 [[ PQ [[Yu 6,7R,( [[ PQ [[Yu 6,7R," ,,8,:/0b!F"0H [[ PQ [[Yu 6"17R"1H [[ PQ [[Yu 6,7R,* [[ PQ [[Yu 6 [[Y!eD!T.BHBHHaSM(RS [[Wuhbhhuo&>? 3@T7R 3 [[ 56C7CJ" 27B* 30&11* [[WtS"&&&9:1;1 [[XAS'AB)C)  [[Y(9: H; H 1, [[WtRXX&67,8, [[ PQ [[Yu 6 [[Y!eAqk(:;-<7R- [[ PQ [[Yu 6,7R,$#9J *D <00" [[_tRXX.>? [[Z$)9: ,;@ , -,.. !/ !Cr1r:ceZdZdZej j dej jdddgdZdZ y) TestILocErrorsc|}|tur|j}d}tjt|5|j ddddtjt t5tj|xr|tu5d|j d<ddddddy#1swYixYw#1swYxYw#1swYyxYw)Nz5Cannot index by location index with a non-integer keyrtg@r) rrkr5rrr(r+_slice_iloc_msgrOrE)r,series_with_simple_indexrarr.rs r/test_iloc_float_raisesz%TestILocErrors.test_iloc_float_raises s' i ',,.CE ]]9C 0  HHSM ]]:_ = "&&"C)'C "!"  " " "   " " " "s/B0/ CB<C0B9<C CCrWrXTFc2tjtd5|jddddddfddd|r|dd}tjtd5d|jddddddf<dddy#1swYMxYw#1swYyxYw)NzToo many indexersrtztoo many indices for arrayr)r5rrr(r+)r, float_framerXrds r/*test_iloc_getitem_setitem_fancy_exceptionsz9TestILocErrors.test_iloc_getitem_setitem_fancy_exceptions"s]]=0C D &   Q1W % & q>D ]]:-I J *()K  Q1W % * *  & &  * *sBB B  BcDtdgdi}tdgdi}d}tjt|5d|j|<dddd}tjt |5|j|dddy#1swY?xYw#1swYyxYw)NrrrzADataFrame indexer for .iloc is not supported. Consider using .locrtrzWDataFrame indexer is not allowed for .iloc Consider using .loc for automatic alignment.)rr5rrr(r+)r,rSr<rs r/test_iloc_frame_indexerz&TestILocErrors.test_iloc_frame_indexer.s Y' (S"567Q ]]9C 0 ! BGGG  ! ; ]]:S 1  GGG    ! !  sB 1B BBN) r2r3r4rr5r6rr7rrr8r1r/rrsN"0 [[ PQ [[Yu 6*7R* r1rcjeZdZdZdZdZejjgdddgdZ y) TestILocSetItemDuplicateColumnsc4tddddddg}tddddddg}t||gd}d|jd<|jddk(sJ|jd dk(sJ|jjdtj k(sJy) Nrrrr;r\rrrC)rr)rrr(dtypesrMr)r,rrrSs r/*test_iloc_setitem_scalar_duplicate_columnszJTestILocSetItemDuplicateColumns.test_iloc_setitem_scalar_duplicate_columns?st!,AA.>?@qq)+;<= S#JQ ' wwt}"""wwt}!!!yy~~a BHH,,,r1ctgdggd}dg|jdddf<tgdggd}tj||y)N)rr(str2rrrrrstr3r)rr(rrr|s r/(test_iloc_setitem_list_duplicate_columnszHTestILocSetItemDuplicateColumns.test_iloc_setitem_list_duplicate_columnsJsE *+_ E1 01?K b(+r1cbttjdtjj ddgd}|j dddfj tj|j dddf<|jj dtjk(sJy)Nrr>rr\rrrr) rrMrrrr(rLrur)r,rSs r/*test_iloc_setitem_series_duplicate_columnszJTestILocSetItemDuplicateColumns.test_iloc_setitem_series_duplicate_columnsSs{  IIarxx ( 0 0A 6@T 1 ,,RZZ81 yy~~a BHH,,,r1)r init_valueexpected_value)r0r)floatz1.2g333333?ct|ddgggdt}|jdddfj||jdddf<t|ddgggdt}t j ||y)Nr(rr)rsr?r)rrFr(rLrOrP)r,rrrrS expected_dfs r/*test_iloc_setitem_dtypes_duplicate_columnszJTestILocSetItemDuplicateColumns.test_iloc_setitem_dtypes_duplicate_columnsZsx% ( )?&  1 ,,V41 eV , -# b+.r1N) r2r3r4rrrr5r6r7rr8r1r/rr>s@ -,- [[2 12/ /r1rceZdZdZdZy)TestILocCallablectgdtddtd}|jd}tj||jddg|jd ddf}tj||jddgddf|jd d f}tj ||jddgd f|jd df}tj||jddgd gf|jddgdf}tj ||jddgd f|jddgdf}tj||jddgd gf|jdd f}tj ||jddgd f|jdd gf}tj||jddgd gfy)Nr[aabbXYrrgc ddgSNrr;r8rs r/rzCTestILocCallable.test_frame_iloc_getitem_callable..x Ar1rr;c ddgSrr8rs r/rzCTestILocCallable.test_frame_iloc_getitem_callable..{rr1c ddgSrr8rs r/rzCTestILocCallable.test_frame_iloc_getitem_callable..~rr1cyNrr8rs r/rzCTestILocCallable.test_frame_iloc_getitem_callable..~r1rc ddgSrr8rs r/rzCTestILocCallable.test_frame_iloc_getitem_callable..rr1cdgSrr8rs r/rzCTestILocCallable.test_frame_iloc_getitem_callable..s1#r1cyrr8rs r/rzCTestILocCallable.test_frame_iloc_getitem_callable..rr1cdgSrr8rs r/rzCTestILocCallable.test_frame_iloc_getitem_callable..sr1c ddgSrr8rs r/rzCTestILocCallable.test_frame_iloc_getitem_callable..rr1c ddgSrr8rs r/rzCTestILocCallable.test_frame_iloc_getitem_callable..rr1)rrr(rOrPr)r,rSrs r/ test_frame_iloc_getitem_callablez1TestILocCallable.test_frame_iloc_getitem_callabless \V =T&\ Rgg&' c277Aq6?3gg&)* c277Aq619#56gg& 34 sBGGQFAI$67gg& 56 c277Aq6A3;#78ggq!fk)* sBGGQFAI$67ggq!fm+, c277Aq6A3;#78gg&)* sBGGQFAI$67gg&+, c277Aq6A3;#78r1c6tgdttdtdtd}|j }d|j d<|j }d|j d d g<t j|||j }d |j d ddf<|j }d |j d d gddf<t j|||j }d |j ddf<|j }d |j d d gdf<t j|||j }d|j ddf<|j }d|j d d gdgf<t j|||j }d|j d d gdf<|j }d|j d d gdf<t j|||j }d|j d d gdf<|j }d|j d d gdgf<t j|||j }d|j ddf<|j }d|j d d gdf<t j|||j }ddg|j ddgf<|j }ddg|j d d gdgf<t j||y)Nr[rr>rrrgrc ddgSrr8rs r/rzCTestILocCallable.test_frame_iloc_setitem_callable.. Aq6r1rr;rc ddgSrr8rs r/rzCTestILocCallable.test_frame_iloc_setitem_callable..rr1rpc ddgSrr8rs r/rzCTestILocCallable.test_frame_iloc_setitem_callable..rr1cyrr8rs r/rzCTestILocCallable.test_frame_iloc_setitem_callable..rr1c ddgSrr8rs r/rzCTestILocCallable.test_frame_iloc_setitem_callable..rr1cdgSrr8rs r/rzCTestILocCallable.test_frame_iloc_setitem_callable..saSr1rcyrr8rs r/rzCTestILocCallable.test_frame_iloc_setitem_callable..rr1cdgSrr8rs r/rzCTestILocCallable.test_frame_iloc_setitem_callable..sA3r1rzc ddgSrr8rs r/rzCTestILocCallable.test_frame_iloc_setitem_callable..rr1c ddgSrr8rs r/rzCTestILocCallable.test_frame_iloc_setitem_callable..rr1)rr rrFrJr(rOrP)r,rSrrs r/ test_frame_iloc_setitem_callablez1TestILocCallable.test_frame_iloc_setitem_callables VDL%G Hv,  ggi%&!"ggi!Q c3'ggi(*!1$%ggi !Q c3'ggi23!;./ggi!Q c3'ggi46!=01ggi "!Q! c3'ggi(*!Q$%ggi !Q c3'ggi*,!Q&'ggi "!Q! c3'ggi(*!1$%ggi !Q c3'ggi+-r(!A3&'ggi!#R!Q! c3'r1N)r2r3r4rrr8r1r/rrrs 9<7(r1rc$eZdZdZdZdZdZy)TestILocSeriesc ttjjdj dt t ddd}|j}t t|D]9}|j|}||j|}tj||;|jtdd}|jdd}tj||tj d5tj"|5d|dddddddd|rtj||n"|jdddk(j%sJ|jgd }|j'|jgd }tj||y#1swYxYw#1swYxYw) Nrrzrrorgrr;r\)rrr;r\rp)r rMrrrrrErJrr(rhrOrrrrrrErFreindex) r,rbrrl ser_originalrArrrUs r/ test_iloczTestILocSeries.test_ilocs II ! !! $ 4 4R 8U1bRS_@U xxz s3x 0AXXa[Fciil#C  " "63 / 0 %1+&771Q< vx0 ' ' - &&'9: q      " "3 5HHQqMQ&++- --/*;;syy9: vx0    s$F<F0F<0F9 5F<<GcNtgdgd}|jddk(sJy)Nrrrgr)r r()r,rls r/test_iloc_getitem_nonuniquez*TestILocSeries.test_iloc_getitem_nonuniques$Yi0xx{ar1ctgd}tgdgd}|jdd|jddtgd}tj||y)Nrr)rrrrgrr;)rrpr)r r(rOr)r,ser1ser2rUs r/rz4TestILocSeries.test_iloc_setitem_pure_position_basedsKi iy11Q !A)$ tX.r1cptdgtjgd}tjt d5|j dddfjd|j dddf<dddtdgttgdd}tj||y#1swY?xYw)Ntest)rrrrtrrr>) rrMrrOrrrrLrrrPrVs r/#test_iloc_nullable_int64_size_1_nanz2TestILocSeries.test_iloc_nullable_int64_size_1_nans&9:  ' ' =Q R D!'AsF!3!:!:7!CFJJq#v  DF8%G2LMN fh/ D Ds 4B,,B5N)r2r3r4rrrrr8r1r/rrs1> /0r1r)+rrrenumpyrMr5 pandas.errorsrpandas.util._test_decoratorsutil_test_decoratorsrpandasrrrrr r r r r rrrrrrpandas._testing_testingrOpandas.api.typesrpandas.tests.indexing.commonrescaperrr:rrrrr8r1r/r*s0  '))"&K"))6   (HCHCV&44n1/1/hV(V(r2020r1