zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
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
U
­ý°d™ã@s*ddlZddlZddlZddlmZmZmZddlm    Z
ej   dddg¡dd„ƒZ ej   dddg¡dd    „ƒZd
d „Zej   d ddd d gfdd d dgfg¡dd„ƒZdd„Zej   dddg¡ej   dddg¡ej   dddg¡dd„ƒƒƒZej   ddejfdg¡ej   dddddg¡d d!„ƒƒZd"d#„ZdS)$éN)Ú    DataFrameÚIndexÚ
date_rangeÚfuncÚffillÚbfillcCsxtdddgdtjtjgdddggtdddgd    d
d }| dg¡ddg}t||ƒƒj}tddgd    d
}t ||¡dS) Néçð?gð¿g@gÀÚtypeÚaÚbÚidx©Úname©Úcolumns)    rÚnpÚnanrÚgroupbyÚgetattrrÚtmZassert_index_equal)rÚdfÚ
df_groupedÚresultÚexpected©rúXd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/groupby/test_missing.pyÚ.test_groupby_column_index_name_lost_fill_funcs sþrcCsŠtdddgdddgdœƒ}tddtjdgiƒ}tj||gddjdgd}tdd    gdtjgdd
ggddgd }t||ƒƒ}t ||¡dS) Nréé)Úfield1Úfield2r )Úaxisr!)Úbyr    g@r)    rrrÚpdÚconcatrrrÚassert_frame_equal)rZdf1Zdf2rrrrrrÚ(test_groupby_fill_duplicate_column_namessÿ r'c    CsBtddgddgdœƒ}tjtdd| d¡ ¡W5QRXdS)Nré©r r zMust specify a fill)Úmatchr )rÚpytestZraisesÚ
ValueErrorrÚfillna)rrrrÚtest_ffill_missing_arguments'sr.zmethod, expectedr cCs`ttjdddgdddddgdœƒ}| d¡}|j|d}tdtj|ddiƒ}t ||¡dS)Nr Ústring)Zdtyperr)r ©Úmethod)rr$Úarrayrr-rr&)r1rrÚgrprrrrÚtest_fillna_with_string_dtype.s
$
 r4c CsÎttj ddgtddƒg¡tddgddd    }tjd
tjtjd tjtjd tjtjd tjg |d<tjdtjtjdtjtjdtjtjdtjg |d<|jdddj    dd}|j
jdd
dj    ddj
}t   ||¡dS)NZvalue1Zvalue2z
2014-01-01z
2014-01-06Ú1Ú2Úidr)Úindexrré r(éré!ré,r)Úlevelr"rr0) rr$Z
MultiIndexZ from_productrrrrrr-ÚTrr&)rrrrrrÚtest_fill_consistency:sFÿüôôr?r1ÚdropnaTFÚ has_nan_groupc Cs.tddgƒ}ddddddg}| |¡jdd}|r8tjnd}t d    gd
|gd
¡|d <|jd |d }t||ƒdd }ddddddgddddddgddddddgddddddgddddddgddddddgddddddgddddddgdœ}    |         |||f¡}| |¡jdd}
|
j
  t ¡|
_
t  ||
¡dS)N)rgš™™™™™¹?)r(gš™™™™™É?éÿÿÿÿrrT)Zdropr r rZ    group_col)r#r@)Úlimit))rTT)rTF)rFT)rFF)rTT)rTF)rFT)rFF)rZreindexZ reset_indexrrr$ZSeriesrrÚgetrZastypeÚobjectrr&) r@r1rAZdf_without_nan_rowsZridxrZgroup_bZgroupedrZ expected_rowsrrrrÚtest_ffill_handles_nan_groupsfs( ø rFzmin_count, valuer()rBr    ÚfirstÚlastÚmaxÚmincCsptdgddtjtjgtjgddœƒ}t| d¡|ƒ|d}t|gtjgdœtdgddd}t ||¡dS)    Nrr©r r Úcr )Ú    min_count)r rLr)r8)rrrrrrrr&)rrMÚvaluerrrrrrÚtest_min_countŠs("rOcCsbtddtjgdddgdddgdœƒ}| d    d
g¡}|j}t d g¡t dg¡d œ}||ks^t‚dS) Nrr(rrééérKr r r))r    r()r    r)rrrrÚindicesr2ÚAssertionError)rÚgrrrrrÚtest_indices_with_missing”s
$rV)Únumpyrr+Zpandasr$rrrZpandas._testingZ_testingrÚmarkZ parametrizerr'r.r4r?rFrrOrVrrrrÚ<module>s. 
 
ÿ
    ,!