1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Ë
oñúhú ãó¼—dZddlmZddlZddlZddlZddlmZddl    m
Z gd¢Z ejd„«Zeje ¬«d„«Zd    „ZGd
„d «Zy) z
Note: for naming purposes, most tests are title with as e.g. "test_nlargest_foo"
but are implicitly also testing nsmallest_foo.
é)ÚproductN)ÚSeries) ÚdatetimeÚ
datetimetzÚ    timedeltaÚint8Úint16Úint32Úint64Úfloat32Úfloat64Úuint8Úuint16Úuint32Úuint64có—tjtjgd¢«tjgd¢«jd«tjgd¢«dœ«}dD]}t gd¢|¬«||<Œ|S)z¯
    A DataFrame with many dtypes
 
    * datetime
    * datetimetz
    * timedelta
    * [u]int{8,16,32,64}
    * float{32,64}
 
    The columns are the name of the dtype.
    )Ú2003Ú2002Ú2001rÚ2005z
US/Eastern)Ú3dÚ2dÚ1drÚ5d)rrr)
rr    r
r r r rrrr)éééré©Údtype)ÚpdÚ    DataFrameÚ to_datetimeÚ tz_localizeÚ to_timedeltar)Údfr s  ú\H:\Change_password\venv_build\Lib\site-packages\pandas/tests/series/methods/test_nlargest.pyÚ s_main_dtypesr(st€ô
‰äŸ™Ò'OÓPÜŸ.™.Ú8óç‰k˜,Ó'ÜŸ™Ò)GÓHñ     
ó
€Bð ò 9ˆôš?°%Ô8ˆˆ5Š    ð 9ð €Ió)Úparamscó —||jS)zEach series in s_main_dtypes.)Úparam)Úrequestr(s  r'Ús_main_dtypes_splitr.Gs€ð ˜Ÿ™Ñ 'Ð'r)có¦—t||¬«}t||«d«}|dk(rgd¢ngd¢}|j|}tj||«y)NrrÚ    nsmallest)rrr)rrr)rÚgetattrÚlocÚtmÚassert_series_equal)Úvalsr ÚmethodÚserÚresultÚ expected_idxrÚexpecteds       r'Úassert_check_nselect_boundaryr;MsM€ä
˜UÔ
#€CØ !ŒWS˜&Ó ! !Ó $€FØ!'¨;Ò!6“IºI€M؏w‰w}Ñ%€HÜ×ј6 8Õ,r)c óê—eZdZejj degd¢d¬«egd¢d¬«egd¢d¬«eed««eed«d¬«g«d    „«Zd
„Z    d „Z
ejj d e d d««d„«Z d„Z d„Zejj dddg«d„«Zd„Zejj dddgdgfgd¢dgfg«d„«Zd„Zd„Zy)ÚTestSeriesNLargestNSmallestÚr)ç@rrrÚ5Úobjectr)r?rrrrÚ
complex128ÚabcdeÚcategorycó —|j}d|›}dt|«ddf}|j|jf}t    ||«D]1\}}t j t|¬«5||«ddd«Œ3y#1swYŒ>xYw)Nz3Cannot use method 'n(largest|smallest)' with dtype rréÿÿÿÿ©Úmatch)r ÚlenÚnlargestr0rÚpytestÚraisesÚ    TypeError)Úselfr>ÚdtÚmsgÚargsÚmethodsr6Úargs        r'Útest_nlargest_errorz/TestSeriesNLargestNSmallest.test_nlargest_errorWs†€ðW‰WˆØCÀBÀ4ÐHˆØ”#a“&˜!˜RЈؗ*‘*˜aŸk™kÐ)ˆÜ" 7¨DÓ1ò    ‰KˆFCÜ—‘œy°Ô4ñ ِs” ÷ ð ñ    ÷ ð ús Á&    A:Á:B    có—|}tj|jd«|jddg«tj|jdd¬«|jddg«|jdd}tj|jd«|«tj|jd«|«tj|j    d«|«tj|j    d«|«tj|jt |««|j ««tj|jt |«dz«|j ««tj|j    t |««|jgd¢«tj|j    t |«dz«|jgd¢«y)    NrrÚlast©ÚkeeprrrF)érrrr)r3r4r0ÚilocrJrIÚ sort_values)rNr.r7Úemptys    r'Útest_nsmallest_nlargestz3TestSeriesNLargestNSmallest.test_nsmallest_nlargestlsg€ð"ˆä
×јsŸ}™}¨QÓ/°·±¸1¸a¸&Ñ1AÔBÜ
×јsŸ}™}¨Q°V˜}Ó<¸c¿h¹hÈÈ1ÀvÑ>NÔOà—‘˜˜1 ˆÜ
×јsŸ}™}¨QÓ/°Ô7Ü
×јsŸ}™}¨RÓ0°%Ô8Ü
×јsŸ|™|¨A›°Ô6Ü
×јsŸ|™|¨BÓ/°Ô7ä
×јsŸ}™}¬S°«XÓ6¸¿¹Ó8IÔJÜ
×јsŸ}™}¬S°«X¸©\Ó:¸C¿O¹OÓ<MÔNÜ
×јsŸ|™|¬C°«HÓ5°s·x±xÂÑ7PÔQÜ
×јsŸ|™|¬C°«H°q©LÓ9¸3¿8¹8ÂOÑ;TÕUr)cóÜ—tdtjdddg«}|j«}|jgd¢}t j ||«|j«}|jgd¢}t j ||«d}tjt|¬«5|jd    ¬
«ddd«tjt|¬«5|jd    ¬
«ddd«tdgdzgd ¢¬ «}tdgd zgd¢¬ «}tdgd zgd¢¬ «}|jd «}t j ||«|jd d¬
«}t j ||«|jd «}t j ||«|jd d¬
«}t j ||«y#1swYŒxYw#1swYŒðxYw)Nr?rrr)rYrrrr)rrrrYrz#keep must be either "first", "last"rGÚinvalidrW)rrrrYr©Úindexr)rrr)rrYrrV) rÚnpÚnanrJrZr3r4r0rKrLÚ
ValueError)rNr7r8r:rPÚexpected_firstÚ expected_lasts       r'Útest_nlargest_miscz.TestSeriesNLargestNSmallest.test_nlargest_miscs‹€Ücœ2Ÿ6™6 1 a¨Ð+Ó,ˆØ—‘“ˆØ—8‘8šOÑ,ˆÜ
×јv xÔ0Ø—‘“ˆØ—8‘8šOÑ,ˆÜ
×јv xÔ0à3ˆÜ ]‰]œ:¨SÔ 1ñ    *Ø M‰M˜yˆMÔ )÷    *ä ]‰]œ:¨SÔ 1ñ    )Ø L‰L˜iˆLÔ (÷    )ôaS˜1‘W¢OÔ4ˆÜ   a¡ªyÔ9ˆÜ ˜s Q™wªiÔ8ˆ à—‘˜qÓ!ˆÜ
×јv ~Ô6à—‘˜q vÓ.ˆÜ
×јv }Ô5à—‘˜a“ˆÜ
×јv ~Ô6à—‘˜a fÓ-ˆÜ
×јv }Õ5÷)    *ñ    *ú÷    )ð    )úsÂ*GàG"ÇGÇ"G+ÚnrrcóB—tgd¢gd¢¬«}|j|«}|jd¬«j|«}t    j
||«|j |«}|j«j|«}t    j
||«y)N)rrYrr)rrrrr`F)Ú    ascending)rrJr[Úheadr3r4r0)rNrhr7r8r:s     r'Útest_nlargest_nz+TestSeriesNLargestNSmallest.test_nlargest_nŸs}€ô’\ªÔ6ˆØ—‘˜a“ˆØ—?‘?¨U?Ó3×8Ñ8¸Ó;ˆÜ
×јv xÔ0à—‘˜qÓ!ˆØ—?‘?Ó$×)Ñ)¨!Ó,ˆÜ
×јv xÕ0r)có—tj|«}|j|j}}||dz|dz
|g}t    |||«y©Nr©rbÚiinfoÚminÚmaxr;)rNÚnselect_methodÚany_int_numpy_dtypeÚ
dtype_infoÚmin_valÚmax_valr5s       r'Útest_nlargest_boundary_integerz:TestSeriesNLargestNSmallest.test_nlargest_boundary_integer«sE€ä—X‘XÐ1Ó2ˆ
Ø%Ÿ>™>¨:¯>©>ˆØ˜ 1™ g°¡k°7Ð;ˆÜ% dÐ,?ÀÕPr)có¾—tj|«}|j|j}}tj||gd|¬«\}}||||g}t |||«y)Nrr)rbÚfinforqrrÚ    nextafterr;)    rNrsÚfloat_numpy_dtyperurvrwÚmin_2ndÚmax_2ndr5s             r'Útest_nlargest_boundary_floatz8TestSeriesNLargestNSmallest.test_nlargest_boundary_float²sZ€ä—X‘XÐ/Ó0ˆ
Ø%Ÿ>™>¨:¯>©>ˆÜŸ<™<¨°'Ð(:¸AÐEVÔWшØ˜ '¨7Ð3ˆÜ% dÐ,=¸~ÕNr)r zdatetime64[ns]ztimedelta64[ns]có˜—tjd«}|j|j}}|dz|dz|dz
||g}t    |||«y)Nr rrro)rNrsr rurvrwr5s       r'Ú#test_nlargest_boundary_datetimelikez?TestSeriesNLargestNSmallest.test_nlargest_boundary_datetimelikeºsK€ô
—X‘X˜gÓ&ˆ
Ø%Ÿ>™>¨:¯>©>ˆØ˜!‘ ˜W q™[¨'°A©+°wÀÐHˆÜ% d¨E°>ÕBr)cóþ—tgd¢«}|jdd¬«}tgd¢«}tj||«|j    dd¬«}tgd¢gd¢¬    «}tj||«y)
N)é
é    éér†r†r†érYÚallrW)rƒr„r…r†r†r†r†r)r‡r†r†r†r†)r†rrYrr‡r`)rrJr3r4r0)rNr7r8r:s    r'Ú%test_nlargest_duplicate_keep_all_tieszATestSeriesNLargestNSmallest.test_nlargest_duplicate_keep_all_tiesÄsh€äÒ.Ó/ˆØ—‘˜a eÓ,ˆÜÒ0Ó1ˆÜ
×јv xÔ0à—‘˜q uÓ-ˆÜš/²ÔAˆÜ
×јv xÕ0r)z data,expectedTF)TFTTcó~—t|«}|jd«}t|«}tj||«yrn)rrJr3r4)rNÚdatar:r7r8s     r'Útest_nlargest_booleanz1TestSeriesNLargestNSmallest.test_nlargest_booleanÏs4€ô
T‹lˆØ—‘˜a“ˆÜ˜(Ó#ˆÜ
×јv xÕ0r)có„—|}|jd«r1tjjd«j    ddd«}n.tjjd«j d«}|j |j«d¬«}t|j«|¬«}tj|d<|jd«}ttj|d«|jjd«¬    «jd«j |«}tj ||«y)
NÚUIntrrrƒF)Úcopyrrr`)Ú
startswithrbÚrandomÚ default_rngÚintegersÚstandard_normalÚastypeÚlowerrrr!ÚNArJÚdeleterar3r4)rNÚany_numeric_ea_dtyper Úarrr7r8r:s       r'Útest_nlargest_nullablez2TestSeriesNLargestNSmallest.test_nlargest_nullableÙsê€à$ˆØ × Ñ ˜FÔ #ä—)‘)×'Ñ'¨Ó*×3Ñ3°A°r¸2Ó>‰Cä—)‘)×'Ñ'¨Ó*×:Ñ:¸2Ó>ˆC؏j‰j˜Ÿ™›¨UˆjÓ3ˆäS—X‘X“Z uÔ-ˆÜ—‘ˆˆA‰Ø—‘˜a“ˆô ”2—9‘9˜S !Ó$¨C¯I©I×,<Ñ,<¸QÓ,?Ô @ß ‰Xa‹[ß ‰VE‹]ð    ô
     ×јv xÕ0r)có—tgd¢«}|jdd¬«}tgd¢«}tj||«tgd¢«}|jdd¬«}tgd¢«}tj||«y)N)rrrrrNrrˆrW)gð?g@r?r?r?)rrNNN)rr0r3r4)rNÚsr8r:s    r'Ú#test_nsmallest_nan_when_keep_is_allz?TestSeriesNLargestNSmallest.test_nsmallest_nan_when_keep_is_allîsr€ä Ò(Ó )ˆØ—‘˜Q UÓ+ˆÜÒ3Ó4ˆÜ
×јv xÔ0ä Ò+Ó ,ˆØ—‘˜Q UÓ+ˆÜÒ2Ó3ˆÜ
×јv xÕ0r)N)Ú__name__Ú
__module__Ú __qualname__rKÚmarkÚ parametrizerÚlistrTr]rgÚrangerlrxrrr‰rŒr›rž©r)r'r=r=Vs*„Ø ‡[[×ÑØ á Ò&¨hÔ 7Ù Ò$¨HÔ 5ñ Ò$¨LÔ 9Ù ‘4˜“=Ó !Ù ‘4˜“=¨
Ô 3ð    
ó ñó ðòVò&6ð@ ‡[[×јS¡%¨¨1£+Ó.ñ    1ó/ð    1òQòOð ‡[[×јWÐ'7Ð9JÐ&KÓLñCóMðCò    1ð ‡[[×ÑØ˜D %˜=¨4¨&Ð1Ò4MÐPTÈvÐ3VÐWóñ1óð1ò1ó*
1r)r=)Ú__doc__Ú    itertoolsrÚnumpyrbrKÚpandasr!rÚpandas._testingÚ_testingr3Ú main_dtypesÚfixturer(r.r;r=r¦r)r'ú<module>r¯snðñõãÛ ãÝÝò€ ð"‡ñ$óð$ðN€‡{Ô#ñ(ó$ð(ò
-÷b1òb1r)