zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
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
U
­ý°d ã@sRddlZddlZddlmZmZmZmZmZm    Z    m
Z
ddl m Z Gdd„dƒZdS)éN)Ú    DataFrameÚ DatetimeIndexÚIndexÚ
MultiIndexÚSeriesÚconcatÚ
date_rangec@sxeZdZdd„Zdd„Zdd„Zdd„Zd    d
„Zd d „Zd d„Z    e
j   de  d¡dfdg¡dd„ƒZdd„Zdd„ZdS)ÚTestSeriesConcatcCsÞt ¡}d|_|dd…|dd…|dd…g}t|ƒ}t ||¡|j|jksTt‚t|dddgd}| ¡}ttj    |j
j dd    ƒ|_
t  dddgd
d „|Dƒ¡t  t|ƒ¡g}tdddg|j
g|d }||_
t ||¡dS) NÚfooééréé)ÚkeyszM8[ns]©ZdtypecSsg|] }t|ƒ‘qS©)Úlen)Ú.0Úxrrú^d:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/reshape/concat/test_series.pyÚ
<listcomp> sz7TestSeriesConcat.test_concat_series.<locals>.<listcomp>)ÚlevelsÚcodes)ÚtmÚmakeTimeSeriesÚnamerÚassert_series_equalÚAssertionErrorÚcopyrÚnpÚarrayÚindexÚvaluesÚrepeatZarangerr)ÚselfÚtsÚpiecesÚresultÚexpectedZ    exp_codesZ    exp_indexrrrÚtest_concat_seriess" *z#TestSeriesConcat.test_concat_seriescCs6tdgƒ}tgtd}|}t||gƒ}t ||¡dS)Nr r)rÚobjectrrr)r$Ús1Ús2r(r'rrrÚ1test_concat_empty_and_non_empty_series_regression%s
 
  zBTestSeriesConcat.test_concat_empty_and_non_empty_series_regressioncCs„t ¡}|dd…|dd…|dd…g}t|dd}t|ƒj}t ||¡t|dddgdd}t|dddgd    j}t ||¡dS)
Néþÿÿÿrr ©ÚaxisÚAÚBÚC)rr0©r!)rrrrÚTÚassert_frame_equal)r$r%r&r'r(rrrÚtest_concat_series_axis1.s" 
 z)TestSeriesConcat.test_concat_series_axis1cCs†ttj d¡dd}ttj d¡dd}t||gdd}t||dœƒ}t ||¡d|_t||gdd}t     |j
t ddgd    d
¡dS) Nr r1©rr2r r/©r1r2rr*r) rrÚrandomÚrandnrrrr6rÚassert_index_equalÚcolumnsr©r$Úsr,r'r(rrrÚ/test_concat_series_axis1_preserves_series_names;s z@TestSeriesConcat.test_concat_series_axis1_preserves_series_namescCs‚ttj d¡dddgdd}ttj d¡ddddgd    d}t||gd
|d }t||d œddddgd }|rr| ¡}t ||¡dS)NéÚcÚaÚbr1©r!réÚdr2r )r0Úsortr9r4)    rrr:r;rrZ
sort_indexrr6)r$rHr?r,r'r(rrrÚ%test_concat_series_axis1_with_reindexHsz6TestSeriesConcat.test_concat_series_axis1_with_reindexcCsÈtdddgƒ}tdddgƒ}t||gdddgd    gd
}tddgddgddggtddgd    d d }t ||¡t||gdd dgd    dgd
}tddgddgddggtjd dgd    dgdd }t ||¡dS)Nr rrArFr érCrDr1)r0rÚnamesr8©r=)rCr )rDrr2)rK)rrrrrr6rÚ from_tuplesr>rrrÚ&test_concat_series_axis1_names_appliedRsÿ þz7TestSeriesConcat.test_concat_series_axis1_names_appliedcCs~tdddddd…}ttj t|ƒ¡|dd}ttj t|ƒ¡|dd}t||gd    d
d }ttd ƒƒ}t    j
|j |d
d dS)Nz 01-Jan-2013z 01-Jan-2014ZMS)ÚfreqréÿÿÿÿÚvaluerEr T©r0Z ignore_indexr)Úexact) rrrr:r;rrrÚrangerr<r=)r$Údatesr+r,r'r(rrrÚ0test_concat_series_axis1_same_names_ignore_indexcs  zATestSeriesConcat.test_concat_series_axis1_same_names_ignore_indexz s1name,s2name龩é+r)rWrXcCsRtdddœ|d}tdddœ|d}t||gƒ}tdddddœƒ}t ||¡dS)    Nr r)rCrDr8r rJ)rBrG)rCrDrBrG)rrrr)r$Zs1nameZs2namer+r,r'r(rrrÚ&test_concat_series_name_npscalar_tuplems
 z7TestSeriesConcat.test_concat_series_name_npscalar_tuplecCsøtddgdd}tddgƒ}tddgƒ}t|||gdd}tddgddgddgdœdd    dgd
}t ||¡t|||gdd d d gd}tddgddgddgdœd d d gd
}t ||¡t|||gddd}tddgddgddgdœƒ}t ||¡dS)Nr rr
r8rFr r/)r
rr rrLÚredÚblueÚyellow)r0r)r[r\r]TrR)rr r)rrrrr6)r$Z named_seriesZunnamed_series1Zunnamed_series2r'r(rrrÚ(test_concat_series_partial_columns_namesxs4  ÿ ýþ ÿz9TestSeriesConcat.test_concat_series_partial_columns_namescCs0|dgƒ}t|jddd…gƒ}t ||¡dS)NédrP)rZilocrZ assert_equal)r$Zframe_or_seriesÚobjr'rrrÚ&test_concat_series_length_one_reversed•s
z7TestSeriesConcat.test_concat_series_length_one_reversedN)Ú__name__Ú
__module__Ú __qualname__r)r-r7r@rIrNrVÚpytestÚmarkZ parametrizerÚint64rZr^rarrrrr    s      
 
ÿ
r    )ÚnumpyrreZpandasrrrrrrrZpandas._testingZ_testingrr    rrrrÚ<module>s$