@@ -357,8 +357,8 @@ def test_field_access_localize(self):
357357 dr = date_range ('2011-10-02 00:00' , freq = 'h' , periods = 10 ,
358358 tz = self .tzstr ('America/Atikokan' ))
359359
360- expected = np .arange (10 , dtype = np .int32 )
361- self .assert_numpy_array_equal (dr .hour , expected )
360+ expected = pd . Index ( np .arange (10 , dtype = np .int64 ) )
361+ self .assert_index_equal (dr .hour , expected )
362362
363363 def test_with_tz (self ):
364364 tz = self .tz ('US/Central' )
@@ -946,35 +946,35 @@ def test_tz_convert_hour_overflow_dst(self):
946946 '2009-05-12 09:50:32' ]
947947 tt = to_datetime (ts ).tz_localize ('US/Eastern' )
948948 ut = tt .tz_convert ('UTC' )
949- expected = np . array ([13 , 14 , 13 ], dtype = np . int32 )
950- self .assert_numpy_array_equal (ut .hour , expected )
949+ expected = Index ([13 , 14 , 13 ])
950+ self .assert_index_equal (ut .hour , expected )
951951
952952 # sorted case UTC -> US/Eastern
953953 ts = ['2008-05-12 13:50:00' ,
954954 '2008-12-12 14:50:35' ,
955955 '2009-05-12 13:50:32' ]
956956 tt = to_datetime (ts ).tz_localize ('UTC' )
957957 ut = tt .tz_convert ('US/Eastern' )
958- expected = np . array ([9 , 9 , 9 ], dtype = np . int32 )
959- self .assert_numpy_array_equal (ut .hour , expected )
958+ expected = Index ([9 , 9 , 9 ])
959+ self .assert_index_equal (ut .hour , expected )
960960
961961 # unsorted case US/Eastern -> UTC
962962 ts = ['2008-05-12 09:50:00' ,
963963 '2008-12-12 09:50:35' ,
964964 '2008-05-12 09:50:32' ]
965965 tt = to_datetime (ts ).tz_localize ('US/Eastern' )
966966 ut = tt .tz_convert ('UTC' )
967- expected = np . array ([13 , 14 , 13 ], dtype = np . int32 )
968- self .assert_numpy_array_equal (ut .hour , expected )
967+ expected = Index ([13 , 14 , 13 ])
968+ self .assert_index_equal (ut .hour , expected )
969969
970970 # unsorted case UTC -> US/Eastern
971971 ts = ['2008-05-12 13:50:00' ,
972972 '2008-12-12 14:50:35' ,
973973 '2008-05-12 13:50:32' ]
974974 tt = to_datetime (ts ).tz_localize ('UTC' )
975975 ut = tt .tz_convert ('US/Eastern' )
976- expected = np . array ([9 , 9 , 9 ], dtype = np . int32 )
977- self .assert_numpy_array_equal (ut .hour , expected )
976+ expected = Index ([9 , 9 , 9 ])
977+ self .assert_index_equal (ut .hour , expected )
978978
979979 def test_tz_convert_hour_overflow_dst_timestamps (self ):
980980 # Regression test for:
@@ -988,35 +988,35 @@ def test_tz_convert_hour_overflow_dst_timestamps(self):
988988 Timestamp ('2009-05-12 09:50:32' , tz = tz )]
989989 tt = to_datetime (ts )
990990 ut = tt .tz_convert ('UTC' )
991- expected = np . array ([13 , 14 , 13 ], dtype = np . int32 )
992- self .assert_numpy_array_equal (ut .hour , expected )
991+ expected = Index ([13 , 14 , 13 ])
992+ self .assert_index_equal (ut .hour , expected )
993993
994994 # sorted case UTC -> US/Eastern
995995 ts = [Timestamp ('2008-05-12 13:50:00' , tz = 'UTC' ),
996996 Timestamp ('2008-12-12 14:50:35' , tz = 'UTC' ),
997997 Timestamp ('2009-05-12 13:50:32' , tz = 'UTC' )]
998998 tt = to_datetime (ts )
999999 ut = tt .tz_convert ('US/Eastern' )
1000- expected = np . array ([9 , 9 , 9 ], dtype = np . int32 )
1001- self .assert_numpy_array_equal (ut .hour , expected )
1000+ expected = Index ([9 , 9 , 9 ])
1001+ self .assert_index_equal (ut .hour , expected )
10021002
10031003 # unsorted case US/Eastern -> UTC
10041004 ts = [Timestamp ('2008-05-12 09:50:00' , tz = tz ),
10051005 Timestamp ('2008-12-12 09:50:35' , tz = tz ),
10061006 Timestamp ('2008-05-12 09:50:32' , tz = tz )]
10071007 tt = to_datetime (ts )
10081008 ut = tt .tz_convert ('UTC' )
1009- expected = np . array ([13 , 14 , 13 ], dtype = np . int32 )
1010- self .assert_numpy_array_equal (ut .hour , expected )
1009+ expected = Index ([13 , 14 , 13 ])
1010+ self .assert_index_equal (ut .hour , expected )
10111011
10121012 # unsorted case UTC -> US/Eastern
10131013 ts = [Timestamp ('2008-05-12 13:50:00' , tz = 'UTC' ),
10141014 Timestamp ('2008-12-12 14:50:35' , tz = 'UTC' ),
10151015 Timestamp ('2008-05-12 13:50:32' , tz = 'UTC' )]
10161016 tt = to_datetime (ts )
10171017 ut = tt .tz_convert ('US/Eastern' )
1018- expected = np . array ([9 , 9 , 9 ], dtype = np . int32 )
1019- self .assert_numpy_array_equal (ut .hour , expected )
1018+ expected = Index ([9 , 9 , 9 ])
1019+ self .assert_index_equal (ut .hour , expected )
10201020
10211021 def test_tslib_tz_convert_trans_pos_plus_1__bug (self ):
10221022 # Regression test for tslib.tz_convert(vals, tz1, tz2).
@@ -1027,9 +1027,8 @@ def test_tslib_tz_convert_trans_pos_plus_1__bug(self):
10271027 idx = idx .tz_localize ('UTC' )
10281028 idx = idx .tz_convert ('Europe/Moscow' )
10291029
1030- expected = np .repeat (np .array ([3 , 4 , 5 ], dtype = np .int32 ),
1031- np .array ([n , n , 1 ]))
1032- self .assert_numpy_array_equal (idx .hour , expected )
1030+ expected = np .repeat (np .array ([3 , 4 , 5 ]), np .array ([n , n , 1 ]))
1031+ self .assert_index_equal (idx .hour , Index (expected ))
10331032
10341033 def test_tslib_tz_convert_dst (self ):
10351034 for freq , n in [('H' , 1 ), ('T' , 60 ), ('S' , 3600 )]:
@@ -1038,62 +1037,57 @@ def test_tslib_tz_convert_dst(self):
10381037 tz = 'UTC' )
10391038 idx = idx .tz_convert ('US/Eastern' )
10401039 expected = np .repeat (np .array ([18 , 19 , 20 , 21 , 22 , 23 ,
1041- 0 , 1 , 3 , 4 , 5 ], dtype = np . int32 ),
1040+ 0 , 1 , 3 , 4 , 5 ]),
10421041 np .array ([n , n , n , n , n , n , n , n , n , n , 1 ]))
1043- self .assert_numpy_array_equal (idx .hour , expected )
1042+ self .assert_index_equal (idx .hour , Index ( expected ) )
10441043
10451044 idx = date_range ('2014-03-08 18:00' , '2014-03-09 05:00' , freq = freq ,
10461045 tz = 'US/Eastern' )
10471046 idx = idx .tz_convert ('UTC' )
1048- expected = np .repeat (np .array ([23 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ],
1049- dtype = np .int32 ),
1047+ expected = np .repeat (np .array ([23 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ]),
10501048 np .array ([n , n , n , n , n , n , n , n , n , n , 1 ]))
1051- self .assert_numpy_array_equal (idx .hour , expected )
1049+ self .assert_index_equal (idx .hour , Index ( expected ) )
10521050
10531051 # End DST
10541052 idx = date_range ('2014-11-01 23:00' , '2014-11-02 09:00' , freq = freq ,
10551053 tz = 'UTC' )
10561054 idx = idx .tz_convert ('US/Eastern' )
10571055 expected = np .repeat (np .array ([19 , 20 , 21 , 22 , 23 ,
1058- 0 , 1 , 1 , 2 , 3 , 4 ], dtype = np . int32 ),
1056+ 0 , 1 , 1 , 2 , 3 , 4 ]),
10591057 np .array ([n , n , n , n , n , n , n , n , n , n , 1 ]))
1060- self .assert_numpy_array_equal (idx .hour , expected )
1058+ self .assert_index_equal (idx .hour , Index ( expected ) )
10611059
10621060 idx = date_range ('2014-11-01 18:00' , '2014-11-02 05:00' , freq = freq ,
10631061 tz = 'US/Eastern' )
10641062 idx = idx .tz_convert ('UTC' )
10651063 expected = np .repeat (np .array ([22 , 23 , 0 , 1 , 2 , 3 , 4 , 5 , 6 ,
1066- 7 , 8 , 9 , 10 ], dtype = np . int32 ),
1064+ 7 , 8 , 9 , 10 ]),
10671065 np .array ([n , n , n , n , n , n , n , n , n ,
10681066 n , n , n , 1 ]))
1069- self .assert_numpy_array_equal (idx .hour , expected )
1067+ self .assert_index_equal (idx .hour , Index ( expected ) )
10701068
10711069 # daily
10721070 # Start DST
10731071 idx = date_range ('2014-03-08 00:00' , '2014-03-09 00:00' , freq = 'D' ,
10741072 tz = 'UTC' )
10751073 idx = idx .tz_convert ('US/Eastern' )
1076- self .assert_numpy_array_equal (idx .hour ,
1077- np .array ([19 , 19 ], dtype = np .int32 ))
1074+ self .assert_index_equal (idx .hour , Index ([19 , 19 ]))
10781075
10791076 idx = date_range ('2014-03-08 00:00' , '2014-03-09 00:00' , freq = 'D' ,
10801077 tz = 'US/Eastern' )
10811078 idx = idx .tz_convert ('UTC' )
1082- self .assert_numpy_array_equal (idx .hour ,
1083- np .array ([5 , 5 ], dtype = np .int32 ))
1079+ self .assert_index_equal (idx .hour , Index ([5 , 5 ]))
10841080
10851081 # End DST
10861082 idx = date_range ('2014-11-01 00:00' , '2014-11-02 00:00' , freq = 'D' ,
10871083 tz = 'UTC' )
10881084 idx = idx .tz_convert ('US/Eastern' )
1089- self .assert_numpy_array_equal (idx .hour ,
1090- np .array ([20 , 20 ], dtype = np .int32 ))
1085+ self .assert_index_equal (idx .hour , Index ([20 , 20 ]))
10911086
10921087 idx = date_range ('2014-11-01 00:00' , '2014-11-02 000:00' , freq = 'D' ,
10931088 tz = 'US/Eastern' )
10941089 idx = idx .tz_convert ('UTC' )
1095- self .assert_numpy_array_equal (idx .hour ,
1096- np .array ([4 , 4 ], dtype = np .int32 ))
1090+ self .assert_index_equal (idx .hour , Index ([4 , 4 ]))
10971091
10981092 def test_tzlocal (self ):
10991093 # GH 13583
0 commit comments