zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
U
­ý°dÍã@sBddlZddlZddlZddlmZddlmZGdd„dƒZ    dS)éN)Ú    DataFramec
@s’eZdZdd„Zdd„Zej ddedddgiƒfdedddgiƒfd    ed    d
d giƒfg¡d d „ƒZ    ej dddg¡dd„ƒZ
dd„Z dd„Z dS)ÚTestDataFrameFilterc    Cs.| dddg¡}t|jƒdks"t‚d|ks.t‚|jdddgdd}t|jƒdksTt‚d|ks`t‚|jdd…}|j|d    d}|j|d
}t ||¡| ¡}d |d <|jdd }t|jƒdksÂt‚d |ksÎt‚t    ddd dgdd ddgd}|jdd }t|jƒdks
t‚t    ddd dgdd dddgd}t    ddd dgt
j d dgt dd}|jdd}t ||¡t    ddd dgddd dgd}|jdd}t ||¡t jtdd| ¡W5QRXt jtdd|jddW5QRXt jtdd|jd dW5QRXt jtdd|jddgd d!d"W5QRXt jtdd|jddgd d d#W5QRXt jtdd|jddgd d$W5QRXt jtdd|jddgd!dd%W5QRXt jtdd|jddgd!d&W5QRX|jd'd }d'|kst‚|jdd(id)}|jdd }d|ks*t‚dS)*NÚAÚBÚEéÚcolumns)ÚaxisréÚindex)r éÚAA©ÚlikegZ_AZ_B)r rÚ_ÚA1ÚC)Zdtypez^[0-9]+$©ÚregexÚ0Ú1z    Must pass)Úmatch)Úitemszmutually exclusiveZoneZthreeze$Zbbi)rrr)rrr    )rr)rrr    )rrÚfoou∂©r)ÚfilterÚlenrÚAssertionErrorr ZreindexÚtmÚassert_frame_equalÚcopyrÚpdZIndexÚobjectÚpytestZraisesÚ    TypeErrorÚrename)ÚselfÚ float_frameZfloat_string_frameÚfilteredÚidxÚexpectedÚfcopyÚdf©r-ú]d:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/frame/methods/test_filter.pyÚ test_filter
sd       ÿ      zTestDataFrameFilter.test_filtercCsŒ| ¡}d|d<|jdd}t|jƒdks.t‚d|ks:t‚tddgddgddgddgdœƒ}|jdd}|dd    „|jDƒ}t ||¡dS)
Nr r z[A]+rr)ZaBBaZBBaBBZaCCaZaCCaBBÚBBcSsg|]}d|kr|‘qS)r0r-)Ú.0Úxr-r-r.Ú
<listcomp>asz@TestDataFrameFilter.test_filter_regex_search.<locals>.<listcomp>)r rrrrrrr)r&r'r+r(r,ÚresultÚexpr-r-r.Útest_filter_regex_searchRs  ÿ z,TestDataFrameFilter.test_filter_regex_searchz name,expectedÚar rõあér
cCsBtddgddgdœƒ}t |j|d|¡t |j|d|¡dS)Nr rr9r
)r7r8rr©rrrr)r&Únamer*r,r-r-r.Útest_filter_unicodeds
z'TestDataFrameFilter.test_filter_unicoder;cCsRtddgddgdœƒ}tdddgiƒ}t |j|d|¡t |j|d|¡dS)    Nr rr9r
)óaóbr=rrr:)r&r;r,r*r-r-r.Útest_filter_bytestringssz*TestDataFrameFilter.test_filter_bytestringcCs8tƒ}| g¡}t ||¡|jdd}t ||¡dS)Nrr)rrrr)r&Úemptyr4r-r-r.Útest_filter_corner|s
 
  z&TestDataFrameFilter.test_filter_cornercCs>ttj d¡ddgd}|jdd}|dg}t ||¡dS)N)r9rÚSTRINGé{rr)rÚnpÚrandomrrr)r&r,r4r*r-r-r.Útest_filter_regex_non_string…s 
z0TestDataFrameFilter.test_filter_regex_non_stringN) Ú__name__Ú
__module__Ú __qualname__r/r6r#ÚmarkZ parametrizerr<r?rArFr-r-r-r.r    sHýþ
 
    r)
ÚnumpyrDr#Zpandasr!rZpandas._testingZ_testingrrr-r-r-r.Ú<module>s