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
U
­ý°déã@sJddlZddlZddlZddlmZmZmZddlm    Z
Gdd„dƒZ dS)éN)Ú    DataFrameÚSeriesÚ
date_rangec@sTeZdZdd„Zdd„Zdd„Zdd„Zd    d
„Zd d „Zd d„Z    dd„Z
dd„Z dS)ÚTestDataFrameRoundc    Csštƒ}t || ¡¡tdddgdddgdœƒ}tdd    d
gdd    d
gdœƒ}t | ¡|¡d }td d dgdddgdœƒ}t | |¡|¡t t ||¡|¡dd g}d}tjt|d| |¡W5QRXtdddgdddgdœƒ}dd dœ}t | |¡|¡tdddgdddgdœƒ}ddi}t | |¡|¡d ddœ}    t | |    ¡|¡dddœ}
d}tjt|d| |
¡W5QRXdddœ}
tjt|d| |
¡W5QRXt|
ƒ} tjt|d| | ¡W5QRXddd gdœ}
tjt|d| |
¡W5QRXt|
ƒ} tjt|d| | ¡W5QRXt|
ƒ} tjt|d| | ¡W5QRXt|
ƒ} tjt|d| | ¡W5QRXd d!dœ} |d"} td#d$d%gd&d'd(gdœƒ}t |  | ¡|¡ttj    ddœƒ}tjt|d| |¡W5QRXt 
|d) d¡|d)¡d }td d dgdddgdœƒ}d*|j _ d*|j _ t | |¡|¡t 
|d) |¡|d)¡t 
| |¡d)|d)¡dS)+Nç+‡ÙÎ÷ñ?ç–C‹lçû@ç–C‹lçû@çX9´Èv¾ó?ç¬Zd;ß@ç¬Zd;ß    @©Úcol1Úcol2çð?ç@ç@égìQ¸…ëñ?gö(\Âõ@gö(\Âõ@g®Gáz®ó?g×£p=
×@g×£p=
×    @éz4decimals must be an integer, a dict-like or a Series©Úmatch皙™™™™ñ?gÍÌÌÌÌÌ@gÍÌÌÌÌÌ@g333333ó?皙™™™™@gš™™™™™    @r)Úcol3rgà?z#Values in decimals must be integersZfooéÿÿÿÿéþÿÿÿédg€[@éÒi6gY@éÈi,r Úcols) rÚtmÚassert_frame_equalÚroundÚnpÚpytestÚraisesÚ    TypeErrorrÚnanZassert_series_equalÚcolumnsÚname)ÚselfÚdfÚexpected_roundedÚdecimalsZ
round_listÚmsgZ
round_dictZexpected_partially_roundedZpartial_round_dictZwrong_round_dictZnon_int_round_dictZnon_int_round_SeriesZnegative_round_dictZbig_dfZexpected_neg_roundedZnan_round_Series©r.ú\d:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/frame/methods/test_round.pyÚ
test_roundsˆÿÿ
ÿ
 
 
 
ÿÿzTestDataFrameRound.test_roundc    Csttddgddggƒ}tj|dd}tddgd    d
ggƒ}t ||¡d }tjt|d tj|d|d W5QRXdS)Nç{®Gázø?gÃõ(\Âõ?縅ëQ¸®?g
×£p=
@r)r,rrçg@z$the 'out' parameter is not supportedr)r,Úout)rr"r!rr r#r$Ú
ValueError)r)r*r4Úexpectedr-r.r.r/Útest_round_numpys z#TestDataFrameRound.test_round_numpyc    CsVtdtjdgƒ ¡}t d¡| ¡}W5QRXtdtjdgƒ ¡}t ||¡dS)Nr1r2rr3)rr"r&Zto_framerZassert_produces_warningr!r )r)r*Úresultr6r.r.r/Útest_round_numpy_with_nanŠs
 z,TestDataFrameRound.test_round_numpy_with_nancCsÐtddddgddddgtd    d
d d œƒ}td dddgddddgtd    d
d d œƒ}t | ¡|¡t | d¡|¡t | ddi¡|¡t | ddi¡|¡t | dddœ¡|¡t | ddi¡|¡dS)Nrrgffffff
@gš™™™™™@Ú1ÚaÚcÚfZ20111111é)Zperiods)r rrrrrg@rr rr r)rrrr r!)r)r*Zround_0r.r.r/Útest_round_mixed_type’s$
 
 
ýÿ
 
 
ýÿz(TestDataFrameRound.test_round_mixed_typec    Cs”ttj ddg¡dddgdddgd}tj||fd    d
}| ¡}t |j|j¡t    d    d d gdddgd }d}t
j t |d| |¡W5QRXdS)NéÚAÚBÚCÚfirstÚsecondÚthird)r'Úindexr)Zaxisrr)rGz Index of decimals must be uniquer) rr"ÚrandomÚpdÚconcatr!rZassert_index_equalrGrr#r$r5)r)r*ÚdfsZroundedr,r-r.r.r/Ú!test_round_with_duplicate_columns©sýz4TestDataFrameRound.test_round_with_duplicate_columnscCsHtdddgdddgdœƒ}tdd    d
gdd    d
gdœƒ}t t|ƒ|¡dS) Nrrrr    r
r r rrr)rrr r!)r)r*r+r.r.r/Útest_round_builtin»sz%TestDataFrameRound.test_round_builtincCsˆt dgddgd¡}ttj dd¡tdƒd}| d¡}||_|     ¡ 
|¡}|j dks`t ‚| d¡}|j dksxt ‚t  ||¡dS)NÚlowr@ÚhiéÚabc©r')rPr@)rIÚCategoricalIndexrr"rHZrandÚlistr!rGÚcopyZ    set_indexÚshapeÚAssertionErrorrr )r)Úidxr*r6Zdf_categoricalr8r.r.r/Ú test_round_nonunique_categoricalÄs
 
z3TestDataFrameRound.test_round_nonunique_categoricalcCsZt t dd¡¡}tddgddgg|d}| ¡}tddgd    d    gg|d}t ||¡dS)
Nrrg…ëQ¸å?rg333333Ó?gÐ?rRrr3)rIrSZinterval_rangerr!rr )r)r'r*r8r6r.r.r/Ú$test_round_interval_category_columnsÓs
z7TestDataFrameRound.test_round_interval_category_columnscCs*tƒ}| ¡}t ||¡||k    s&t‚dS)N)rr!rr rW)r)r*r8r.r.r/Útest_round_empty_not_inputÜs z-TestDataFrameRound.test_round_empty_not_inputN) Ú__name__Ú
__module__Ú __qualname__r0r7r9r?rLrMrYrZr[r.r.r.r/r sq         r) Únumpyr"r#ZpandasrIrrrZpandas._testingZ_testingrrr.r.r.r/Ú<module>s