@@ -119,23 +119,41 @@ def test_representation(self):
119
119
idx6 = DatetimeIndex (['2011-01-01 09:00' , '2011-01-01 10:00' , pd .NaT ],
120
120
tz = 'US/Eastern' )
121
121
122
- exp1 = """<class 'pandas.tseries.index.DatetimeIndex'>
123
- Length: 0, Freq: D, Timezone: None"""
124
- exp2 = """<class 'pandas.tseries.index.DatetimeIndex'>
125
- [2011-01-01]
126
- Length: 1, Freq: D, Timezone: None"""
127
- exp3 = """<class 'pandas.tseries.index.DatetimeIndex'>
128
- [2011-01-01, 2011-01-02]
129
- Length: 2, Freq: D, Timezone: None"""
130
- exp4 = """<class 'pandas.tseries.index.DatetimeIndex'>
131
- [2011-01-01, ..., 2011-01-03]
132
- Length: 3, Freq: D, Timezone: None"""
133
- exp5 = """<class 'pandas.tseries.index.DatetimeIndex'>
134
- [2011-01-01 09:00:00+09:00, ..., 2011-01-01 11:00:00+09:00]
135
- Length: 3, Freq: H, Timezone: Asia/Tokyo"""
136
- exp6 = """<class 'pandas.tseries.index.DatetimeIndex'>
137
- [2011-01-01 09:00:00-05:00, ..., NaT]
138
- Length: 3, Freq: None, Timezone: US/Eastern"""
122
+ exp1 = """DatetimeIndex([],
123
+ dtype='datetime64[ns]',
124
+ length=0,
125
+ freq='D',
126
+ tz=None)"""
127
+
128
+ exp2 = """DatetimeIndex([2011-01-01],
129
+ dtype='datetime64[ns]',
130
+ length=1,
131
+ freq='D',
132
+ tz=None)"""
133
+
134
+ exp3 = """DatetimeIndex([2011-01-01, 2011-01-02],
135
+ dtype='datetime64[ns]',
136
+ length=2,
137
+ freq='D',
138
+ tz=None)"""
139
+
140
+ exp4 = """DatetimeIndex([2011-01-01, ..., 2011-01-03],
141
+ dtype='datetime64[ns]',
142
+ length=3,
143
+ freq='D',
144
+ tz=None)"""
145
+
146
+ exp5 = """DatetimeIndex([2011-01-01 09:00:00+09:00, ..., 2011-01-01 11:00:00+09:00],
147
+ dtype='datetime64[ns]',
148
+ length=3,
149
+ freq='H',
150
+ tz='Asia/Tokyo')"""
151
+
152
+ exp6 = """DatetimeIndex([2011-01-01 09:00:00-05:00, ..., NaT],
153
+ dtype='datetime64[ns]',
154
+ length=3,
155
+ freq=None,
156
+ tz='US/Eastern')"""
139
157
140
158
for idx , expected in zip ([idx1 , idx2 , idx3 , idx4 , idx5 , idx6 ],
141
159
[exp1 , exp2 , exp3 , exp4 , exp5 , exp6 ]):
@@ -372,21 +390,30 @@ def test_representation(self):
372
390
idx4 = TimedeltaIndex (['1 days' , '2 days' , '3 days' ], freq = 'D' )
373
391
idx5 = TimedeltaIndex (['1 days 00:00:01' , '2 days' , '3 days' ])
374
392
393
+ exp1 = """TimedeltaIndex([],
394
+ dtype='timedelta64[ns]',
395
+ length=0,
396
+ freq='D')"""
375
397
376
- exp1 = """<class 'pandas.tseries.tdi.TimedeltaIndex'>
377
- Length: 0, Freq: D"""
378
- exp2 = """<class 'pandas.tseries.tdi.TimedeltaIndex'>
379
- ['1 days']
380
- Length: 1, Freq: D"""
381
- exp3 = """<class 'pandas.tseries.tdi.TimedeltaIndex'>
382
- ['1 days', '2 days']
383
- Length: 2, Freq: D"""
384
- exp4 = """<class 'pandas.tseries.tdi.TimedeltaIndex'>
385
- ['1 days', ..., '3 days']
386
- Length: 3, Freq: D"""
387
- exp5 = """<class 'pandas.tseries.tdi.TimedeltaIndex'>
388
- ['1 days 00:00:01', ..., '3 days 00:00:00']
389
- Length: 3, Freq: None"""
398
+ exp2 = """TimedeltaIndex(['1 days'],
399
+ dtype='timedelta64[ns]',
400
+ length=1,
401
+ freq='D')"""
402
+
403
+ exp3 = """TimedeltaIndex(['1 days', '2 days'],
404
+ dtype='timedelta64[ns]',
405
+ length=2,
406
+ freq='D')"""
407
+
408
+ exp4 = """TimedeltaIndex(['1 days', ..., '3 days'],
409
+ dtype='timedelta64[ns]',
410
+ length=3,
411
+ freq='D')"""
412
+
413
+ exp5 = """TimedeltaIndex(['1 days 00:00:01', ..., '3 days 00:00:00'],
414
+ dtype='timedelta64[ns]',
415
+ length=3,
416
+ freq=None)"""
390
417
391
418
for idx , expected in zip ([idx1 , idx2 , idx3 , idx4 , idx5 ],
392
419
[exp1 , exp2 , exp3 , exp4 , exp5 ]):
@@ -835,32 +862,50 @@ def test_representation(self):
835
862
idx8 = pd .period_range ('2013Q1' , periods = 2 , freq = "Q" )
836
863
idx9 = pd .period_range ('2013Q1' , periods = 3 , freq = "Q" )
837
864
838
- exp1 = """<class 'pandas.tseries.period.PeriodIndex'>
839
- Length: 0, Freq: D"""
840
- exp2 = """<class 'pandas.tseries.period.PeriodIndex'>
841
- [2011-01-01]
842
- Length: 1, Freq: D"""
843
- exp3 = """<class 'pandas.tseries.period.PeriodIndex'>
844
- [2011-01-01, 2011-01-02]
845
- Length: 2, Freq: D"""
846
- exp4 = """<class 'pandas.tseries.period.PeriodIndex'>
847
- [2011-01-01, ..., 2011-01-03]
848
- Length: 3, Freq: D"""
849
- exp5 = """<class 'pandas.tseries.period.PeriodIndex'>
850
- [2011, ..., 2013]
851
- Length: 3, Freq: A-DEC"""
852
- exp6 = """<class 'pandas.tseries.period.PeriodIndex'>
853
- [2011-01-01 09:00, ..., NaT]
854
- Length: 3, Freq: H"""
855
- exp7 = """<class 'pandas.tseries.period.PeriodIndex'>
856
- [2013Q1]
857
- Length: 1, Freq: Q-DEC"""
858
- exp8 = """<class 'pandas.tseries.period.PeriodIndex'>
859
- [2013Q1, 2013Q2]
860
- Length: 2, Freq: Q-DEC"""
861
- exp9 = """<class 'pandas.tseries.period.PeriodIndex'>
862
- [2013Q1, ..., 2013Q3]
863
- Length: 3, Freq: Q-DEC"""
865
+ exp1 = """PeriodIndex([],
866
+ dtype='int64',
867
+ length=0,
868
+ freq='D')"""
869
+
870
+ exp2 = """PeriodIndex([2011-01-01],
871
+ dtype='int64',
872
+ length=1,
873
+ freq='D')"""
874
+
875
+ exp3 = """PeriodIndex([2011-01-01, 2011-01-02],
876
+ dtype='int64',
877
+ length=2,
878
+ freq='D')"""
879
+
880
+ exp4 = """PeriodIndex([2011-01-01, ..., 2011-01-03],
881
+ dtype='int64',
882
+ length=3,
883
+ freq='D')"""
884
+
885
+ exp5 = """PeriodIndex([2011, ..., 2013],
886
+ dtype='int64',
887
+ length=3,
888
+ freq='A-DEC')"""
889
+
890
+ exp6 = """PeriodIndex([2011-01-01 09:00, ..., NaT],
891
+ dtype='int64',
892
+ length=3,
893
+ freq='H')"""
894
+
895
+ exp7 = """PeriodIndex([2013Q1],
896
+ dtype='int64',
897
+ length=1,
898
+ freq='Q-DEC')"""
899
+
900
+ exp8 = """PeriodIndex([2013Q1, 2013Q2],
901
+ dtype='int64',
902
+ length=2,
903
+ freq='Q-DEC')"""
904
+
905
+ exp9 = """PeriodIndex([2013Q1, ..., 2013Q3],
906
+ dtype='int64',
907
+ length=3,
908
+ freq='Q-DEC')"""
864
909
865
910
for idx , expected in zip ([idx1 , idx2 , idx3 , idx4 , idx5 , idx6 , idx7 , idx8 , idx9 ],
866
911
[exp1 , exp2 , exp3 , exp4 , exp5 , exp6 , exp7 , exp8 , exp9 ]):
0 commit comments