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
U
­ý°dx ã@sVddlmZddlZddlZddlmZmZmZm    Z    m
Z
ddl m Z Gdd„dƒZdS)é)ÚdateN)Ú CategoricalÚCategoricalDtypeÚCategoricalIndexÚIndexÚ IntervalIndexc@sleZdZdd„Zej dddg¡ej dddg¡ej d    ddg¡d
d „ƒƒƒZej d ddg¡d d„ƒZdS)Ú
TestAstypecCsÚttdƒtdƒdd}| t¡}t |tt |¡ƒ¡|     |¡sDt
‚t |tƒsRt
‚t |tƒr`t
‚t j ddgddgd    d
}ttjd d d g|ddƒ}| d¡}|jd d d gdtjd}t ||¡t |jƒ}t ||¡dS)NÚaabbcaÚcabF©Ú
categoriesÚorderedgü©ñÒMbP¿g@ééÚright)ÚleftrÚclosedrééÿÿÿÿTÚinterval)Z
allow_fillZ
fill_value)rÚlistÚastypeÚobjectÚtmÚassert_index_equalrÚnpÚarrayÚequalsÚAssertionErrorÚ
isinstancerZ from_arraysrZ
from_codesZtakeÚnanÚvalues)ÚselfÚciÚresultÚiiÚexpected©r'úcd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/indexes/categorical/test_astype.pyÚ test_astypes
ÿ
 
zTestAstype.test_astypeÚnameNZfooÚ dtype_orderedTFÚ index_orderedcCsÂttdƒtdƒ|d}|r$| |¡}t|d}| |¡}t| ¡||j|d}t ||¡t|     ¡ ¡dd…|ƒ}| |¡}t| ¡||d}t ||¡|dkr¾| d    ¡}|}t ||¡dS)
Nr    r
r )r )r*r r r)r*ÚdtypeFÚcategory)
rrÚrenamerrÚtolistr rrÚunique)r"r*r+r,Úindexr-r$r&r'r'r(Útest_astype_category*s0ÿ
 
 
ü 
 
zTestAstype.test_astype_categoryÚboxcCsft ¡}t||gƒ}|jtks"t‚|r,|j}| d¡}| t¡}|jtksNt‚t|dƒtksbt‚dS)Nr.r)    rÚtodayrr-rrrrÚtype)r"r4ÚvÚobjÚcatZrtripr'r'r(Útest_categorical_date_roundtripLs 
 
z*TestAstype.test_categorical_date_roundtrip)    Ú__name__Ú
__module__Ú __qualname__r)ÚpytestÚmarkZ parametrizer3r:r'r'r'r(rsr)ÚdatetimerÚnumpyrr>ZpandasrrrrrZpandas._testingZ_testingrrr'r'r'r(Ú<module>s