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
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
58
59
60
61
U
­ý°d‚ã@sNddlZddlZddlZddlmZmZddlmZ    dd„Z
Gdd„dƒZ dS)éN)Ú PeriodIndexÚSeriescCsêtdddgdd}tjdddgdd}| ¡}t ||¡|jdd    }t ||¡tjd
d d gdd}|jd d}t ||¡tdtjdgdd}tjdddgtd}| ¡}t ||¡tjdddgtd}|jdd    }t ||¡dS)Nz
2017-01-01z
2017-01-02z
2017-01-03ÚD©Úfreqz=U10)ZdtypeÚpandas)Zna_repz
01-2017-01z
01-2017-02z
01-2017-03z%m-%Y-%d)Z date_formatÚNaT)    rÚnpÚarrayZ_format_native_typesÚtmZassert_numpy_array_equalÚpdrÚobject)ÚindexÚexpectedÚresult©rú_d:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/indexes/period/test_formats.pyÚtest_to_native_types s        rc@s>eZdZdd„Zej dddg¡dd„ƒZdd    „Zd
d „Z    d S) ÚTestPeriodIndexRenderingcCs>tjddddgitjdddd}t|ƒ}d}||ks:t‚dS)    NÚAéééÚ2000)Úperiods)rz7            A
2000-01-01  1
2000-01-02  2
2000-01-03  3)r Z    DataFrameZ
date_rangeÚreprÚAssertionError)ÚselfZdfrrrrrÚtest_frame_repr-s"z(TestPeriodIndexRendering.test_frame_reprÚmethodÚ__repr__Ú__str__c Cs tgdd}tdgdd}tddgdd}tdddgdd}tdddgd    d}td
d d gd d}tjdddd}tjdddd}    tjdddd}
tddgdd} d} d} d}d}d}d}d}d}d}d}t||||||||    |
| g
| | ||||||||g
ƒD] \}}t||ƒƒ}||ksút‚qúdS) Nrrú
2011-01-01ú
2011-01-02ú
2011-01-03Ú2011Ú2012Ú2013rú2011-01-01 09:00ú2012-02-01 10:00rÚHÚ2013Q1rÚQ©rrrrz
2011-02-01Z3Dz"PeriodIndex([], dtype='period[D]')z.PeriodIndex(['2011-01-01'], dtype='period[D]')z<PeriodIndex(['2011-01-01', '2011-01-02'], dtype='period[D]')zJPeriodIndex(['2011-01-01', '2011-01-02', '2011-01-03'], dtype='period[D]')z<PeriodIndex(['2011', '2012', '2013'], dtype='period[A-DEC]')zOPeriodIndex(['2011-01-01 09:00', '2012-02-01 10:00', 'NaT'], dtype='period[H]')z.PeriodIndex(['2013Q1'], dtype='period[Q-DEC]')z8PeriodIndex(['2013Q1', '2013Q2'], dtype='period[Q-DEC]')zBPeriodIndex(['2013Q1', '2013Q2', '2013Q3'], dtype='period[Q-DEC]')z=PeriodIndex(['2011-01-01', '2011-02-01'], dtype='period[3D]'))rr Ú period_rangeÚzipÚgetattrr)rrÚidx1Úidx2Úidx3Úidx4Úidx5Úidx6Úidx7Úidx8Úidx9Zidx10Úexp1Úexp2Úexp3Úexp4Úexp5Úexp6Úexp7Úexp8Úexp9Zexp10ÚidxrrrrrÚtest_representation3s8 ÿÿþ  z,TestPeriodIndexRendering.test_representationc Cstgdd}tdgdd}tddgdd}tdddgdd}tdddgd    d}td
d d gd d}tjdddd}tjdddd}tjdddd}    d}
d} d} d} d}d}d}d}d}t|||||||||    g    |
| | | |||||g    ƒD] \}}tt|ƒƒ}||ksât‚qâdS)Nrrr"r#r$r%r&r'rr(r)rr*r+rr,r-rrzSeries([], dtype: period[D])z 0    2011-01-01
dtype: period[D]z00    2011-01-01
1    2011-01-02
dtype: period[D]z@0    2011-01-01
1    2011-01-02
2    2011-01-03
dtype: period[D]z20    2011
1    2012
2    2013
dtype: period[A-DEC]zR0    2011-01-01 09:00
1    2012-02-01 10:00
2                 NaT
dtype: period[H]z 0    2013Q1
dtype: period[Q-DEC]z,0    2013Q1
1    2013Q2
dtype: period[Q-DEC]z80    2013Q1
1    2013Q2
2    2013Q3
dtype: period[Q-DEC])rr r.r/rrr©rr1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrrrrrÚtest_representation_to_seriesbs0 þ  z6TestPeriodIndexRendering.test_representation_to_seriesc Cstgdd}tdgdd}tddgdd}tdddgdd}tdddgd    d}td
d d gd d}tjdddd}tjdddd}tjdddd}    d}
d} d} d} d}d}d}d}d}t|||||||||    g    |
| | | |||||g    ƒD]\}}| ¡}||ksât‚qâdS)Nrrr"r#r$r%r&r'rr(r)rr*r+rr,r-rrzPeriodIndex: 0 entries
Freq: Dz8PeriodIndex: 1 entries, 2011-01-01 to 2011-01-01
Freq: Dz8PeriodIndex: 2 entries, 2011-01-01 to 2011-01-02
Freq: Dz8PeriodIndex: 3 entries, 2011-01-01 to 2011-01-03
Freq: Dz0PeriodIndex: 3 entries, 2011 to 2013
Freq: A-DECz7PeriodIndex: 3 entries, 2011-01-01 09:00 to NaT
Freq: Hz4PeriodIndex: 1 entries, 2013Q1 to 2013Q1
Freq: Q-DECz4PeriodIndex: 2 entries, 2013Q1 to 2013Q2
Freq: Q-DECz4PeriodIndex: 3 entries, 2013Q1 to 2013Q3
Freq: Q-DEC)rr r.r/Z_summaryrrErrrÚ test_summaryšs0 þ z%TestPeriodIndexRendering.test_summaryN)
Ú__name__Ú
__module__Ú __qualname__rÚpytestÚmarkZ parametrizerDrFrGrrrrr,s
 
.8r) Únumpyr    rKrr rrZpandas._testingZ_testingr rrrrrrÚ<module>s