@@ -358,8 +358,8 @@ def test_field_access_localize(self):
358358 dr = date_range ('2011-10-02 00:00' , freq = 'h' , periods = 10 ,
359359 tz = self .tzstr ('America/Atikokan' ))
360360
361- expected = np .arange (10 , dtype = np .int32 )
362- self .assert_numpy_array_equal (dr .hour , expected )
361+ expected = pd . Index ( np .arange (10 , dtype = np .int64 ) )
362+ self .assert_index_equal (dr .hour , expected )
363363
364364 def test_with_tz (self ):
365365 tz = self .tz ('US/Central' )
@@ -947,35 +947,35 @@ def test_tz_convert_hour_overflow_dst(self):
947947 '2009-05-12 09:50:32' ]
948948 tt = to_datetime (ts ).tz_localize ('US/Eastern' )
949949 ut = tt .tz_convert ('UTC' )
950- expected = np . array ([13 , 14 , 13 ], dtype = np . int32 )
951- self .assert_numpy_array_equal (ut .hour , expected )
950+ expected = Index ([13 , 14 , 13 ])
951+ self .assert_index_equal (ut .hour , expected )
952952
953953 # sorted case UTC -> US/Eastern
954954 ts = ['2008-05-12 13:50:00' ,
955955 '2008-12-12 14:50:35' ,
956956 '2009-05-12 13:50:32' ]
957957 tt = to_datetime (ts ).tz_localize ('UTC' )
958958 ut = tt .tz_convert ('US/Eastern' )
959- expected = np . array ([9 , 9 , 9 ], dtype = np . int32 )
960- self .assert_numpy_array_equal (ut .hour , expected )
959+ expected = Index ([9 , 9 , 9 ])
960+ self .assert_index_equal (ut .hour , expected )
961961
962962 # unsorted case US/Eastern -> UTC
963963 ts = ['2008-05-12 09:50:00' ,
964964 '2008-12-12 09:50:35' ,
965965 '2008-05-12 09:50:32' ]
966966 tt = to_datetime (ts ).tz_localize ('US/Eastern' )
967967 ut = tt .tz_convert ('UTC' )
968- expected = np . array ([13 , 14 , 13 ], dtype = np . int32 )
969- self .assert_numpy_array_equal (ut .hour , expected )
968+ expected = Index ([13 , 14 , 13 ])
969+ self .assert_index_equal (ut .hour , expected )
970970
971971 # unsorted case UTC -> US/Eastern
972972 ts = ['2008-05-12 13:50:00' ,
973973 '2008-12-12 14:50:35' ,
974974 '2008-05-12 13:50:32' ]
975975 tt = to_datetime (ts ).tz_localize ('UTC' )
976976 ut = tt .tz_convert ('US/Eastern' )
977- expected = np . array ([9 , 9 , 9 ], dtype = np . int32 )
978- self .assert_numpy_array_equal (ut .hour , expected )
977+ expected = Index ([9 , 9 , 9 ])
978+ self .assert_index_equal (ut .hour , expected )
979979
980980 def test_tz_convert_hour_overflow_dst_timestamps (self ):
981981 # Regression test for:
@@ -989,35 +989,35 @@ def test_tz_convert_hour_overflow_dst_timestamps(self):
989989 Timestamp ('2009-05-12 09:50:32' , tz = tz )]
990990 tt = to_datetime (ts )
991991 ut = tt .tz_convert ('UTC' )
992- expected = np . array ([13 , 14 , 13 ], dtype = np . int32 )
993- self .assert_numpy_array_equal (ut .hour , expected )
992+ expected = Index ([13 , 14 , 13 ])
993+ self .assert_index_equal (ut .hour , expected )
994994
995995 # sorted case UTC -> US/Eastern
996996 ts = [Timestamp ('2008-05-12 13:50:00' , tz = 'UTC' ),
997997 Timestamp ('2008-12-12 14:50:35' , tz = 'UTC' ),
998998 Timestamp ('2009-05-12 13:50:32' , tz = 'UTC' )]
999999 tt = to_datetime (ts )
10001000 ut = tt .tz_convert ('US/Eastern' )
1001- expected = np . array ([9 , 9 , 9 ], dtype = np . int32 )
1002- self .assert_numpy_array_equal (ut .hour , expected )
1001+ expected = Index ([9 , 9 , 9 ])
1002+ self .assert_index_equal (ut .hour , expected )
10031003
10041004 # unsorted case US/Eastern -> UTC
10051005 ts = [Timestamp ('2008-05-12 09:50:00' , tz = tz ),
10061006 Timestamp ('2008-12-12 09:50:35' , tz = tz ),
10071007 Timestamp ('2008-05-12 09:50:32' , tz = tz )]
10081008 tt = to_datetime (ts )
10091009 ut = tt .tz_convert ('UTC' )
1010- expected = np . array ([13 , 14 , 13 ], dtype = np . int32 )
1011- self .assert_numpy_array_equal (ut .hour , expected )
1010+ expected = Index ([13 , 14 , 13 ])
1011+ self .assert_index_equal (ut .hour , expected )
10121012
10131013 # unsorted case UTC -> US/Eastern
10141014 ts = [Timestamp ('2008-05-12 13:50:00' , tz = 'UTC' ),
10151015 Timestamp ('2008-12-12 14:50:35' , tz = 'UTC' ),
10161016 Timestamp ('2008-05-12 13:50:32' , tz = 'UTC' )]
10171017 tt = to_datetime (ts )
10181018 ut = tt .tz_convert ('US/Eastern' )
1019- expected = np . array ([9 , 9 , 9 ], dtype = np . int32 )
1020- self .assert_numpy_array_equal (ut .hour , expected )
1019+ expected = Index ([9 , 9 , 9 ])
1020+ self .assert_index_equal (ut .hour , expected )
10211021
10221022 def test_tslib_tz_convert_trans_pos_plus_1__bug (self ):
10231023 # Regression test for tslib.tz_convert(vals, tz1, tz2).
@@ -1028,9 +1028,8 @@ def test_tslib_tz_convert_trans_pos_plus_1__bug(self):
10281028 idx = idx .tz_localize ('UTC' )
10291029 idx = idx .tz_convert ('Europe/Moscow' )
10301030
1031- expected = np .repeat (np .array ([3 , 4 , 5 ], dtype = np .int32 ),
1032- np .array ([n , n , 1 ]))
1033- self .assert_numpy_array_equal (idx .hour , expected )
1031+ expected = np .repeat (np .array ([3 , 4 , 5 ]), np .array ([n , n , 1 ]))
1032+ self .assert_index_equal (idx .hour , Index (expected ))
10341033
10351034 def test_tslib_tz_convert_dst (self ):
10361035 for freq , n in [('H' , 1 ), ('T' , 60 ), ('S' , 3600 )]:
@@ -1039,62 +1038,57 @@ def test_tslib_tz_convert_dst(self):
10391038 tz = 'UTC' )
10401039 idx = idx .tz_convert ('US/Eastern' )
10411040 expected = np .repeat (np .array ([18 , 19 , 20 , 21 , 22 , 23 ,
1042- 0 , 1 , 3 , 4 , 5 ], dtype = np . int32 ),
1041+ 0 , 1 , 3 , 4 , 5 ]),
10431042 np .array ([n , n , n , n , n , n , n , n , n , n , 1 ]))
1044- self .assert_numpy_array_equal (idx .hour , expected )
1043+ self .assert_index_equal (idx .hour , Index ( expected ) )
10451044
10461045 idx = date_range ('2014-03-08 18:00' , '2014-03-09 05:00' , freq = freq ,
10471046 tz = 'US/Eastern' )
10481047 idx = idx .tz_convert ('UTC' )
1049- expected = np .repeat (np .array ([23 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ],
1050- dtype = np .int32 ),
1048+ expected = np .repeat (np .array ([23 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ]),
10511049 np .array ([n , n , n , n , n , n , n , n , n , n , 1 ]))
1052- self .assert_numpy_array_equal (idx .hour , expected )
1050+ self .assert_index_equal (idx .hour , Index ( expected ) )
10531051
10541052 # End DST
10551053 idx = date_range ('2014-11-01 23:00' , '2014-11-02 09:00' , freq = freq ,
10561054 tz = 'UTC' )
10571055 idx = idx .tz_convert ('US/Eastern' )
10581056 expected = np .repeat (np .array ([19 , 20 , 21 , 22 , 23 ,
1059- 0 , 1 , 1 , 2 , 3 , 4 ], dtype = np . int32 ),
1057+ 0 , 1 , 1 , 2 , 3 , 4 ]),
10601058 np .array ([n , n , n , n , n , n , n , n , n , n , 1 ]))
1061- self .assert_numpy_array_equal (idx .hour , expected )
1059+ self .assert_index_equal (idx .hour , Index ( expected ) )
10621060
10631061 idx = date_range ('2014-11-01 18:00' , '2014-11-02 05:00' , freq = freq ,
10641062 tz = 'US/Eastern' )
10651063 idx = idx .tz_convert ('UTC' )
10661064 expected = np .repeat (np .array ([22 , 23 , 0 , 1 , 2 , 3 , 4 , 5 , 6 ,
1067- 7 , 8 , 9 , 10 ], dtype = np . int32 ),
1065+ 7 , 8 , 9 , 10 ]),
10681066 np .array ([n , n , n , n , n , n , n , n , n ,
10691067 n , n , n , 1 ]))
1070- self .assert_numpy_array_equal (idx .hour , expected )
1068+ self .assert_index_equal (idx .hour , Index ( expected ) )
10711069
10721070 # daily
10731071 # Start DST
10741072 idx = date_range ('2014-03-08 00:00' , '2014-03-09 00:00' , freq = 'D' ,
10751073 tz = 'UTC' )
10761074 idx = idx .tz_convert ('US/Eastern' )
1077- self .assert_numpy_array_equal (idx .hour ,
1078- np .array ([19 , 19 ], dtype = np .int32 ))
1075+ self .assert_index_equal (idx .hour , Index ([19 , 19 ]))
10791076
10801077 idx = date_range ('2014-03-08 00:00' , '2014-03-09 00:00' , freq = 'D' ,
10811078 tz = 'US/Eastern' )
10821079 idx = idx .tz_convert ('UTC' )
1083- self .assert_numpy_array_equal (idx .hour ,
1084- np .array ([5 , 5 ], dtype = np .int32 ))
1080+ self .assert_index_equal (idx .hour , Index ([5 , 5 ]))
10851081
10861082 # End DST
10871083 idx = date_range ('2014-11-01 00:00' , '2014-11-02 00:00' , freq = 'D' ,
10881084 tz = 'UTC' )
10891085 idx = idx .tz_convert ('US/Eastern' )
1090- self .assert_numpy_array_equal (idx .hour ,
1091- np .array ([20 , 20 ], dtype = np .int32 ))
1086+ self .assert_index_equal (idx .hour , Index ([20 , 20 ]))
10921087
10931088 idx = date_range ('2014-11-01 00:00' , '2014-11-02 000:00' , freq = 'D' ,
10941089 tz = 'US/Eastern' )
10951090 idx = idx .tz_convert ('UTC' )
1096- self .assert_numpy_array_equal (idx .hour ,
1097- np .array ([4 , 4 ], dtype = np .int32 ))
1091+ self .assert_index_equal (idx .hour , Index ([4 , 4 ]))
10981092
10991093 def test_tzlocal (self ):
11001094 # GH 13583
0 commit comments