@@ -552,20 +552,21 @@ def test_get_loc(self):
552
552
553
553
def test_get_indexer (self ):
554
554
idx = pd .date_range ('2000-01-01' , periods = 3 )
555
- tm .assert_numpy_array_equal (idx .get_indexer (idx ), np .array ([0 , 1 , 2 ]))
555
+ exp = np .array ([0 , 1 , 2 ], dtype = np .intp )
556
+ tm .assert_numpy_array_equal (idx .get_indexer (idx ), exp )
556
557
557
558
target = idx [0 ] + pd .to_timedelta (['-1 hour' , '12 hours' ,
558
559
'1 day 1 hour' ])
559
560
tm .assert_numpy_array_equal (idx .get_indexer (target , 'pad' ),
560
- np .array ([- 1 , 0 , 1 ]))
561
+ np .array ([- 1 , 0 , 1 ], dtype = np . intp ))
561
562
tm .assert_numpy_array_equal (idx .get_indexer (target , 'backfill' ),
562
- np .array ([0 , 1 , 2 ]))
563
+ np .array ([0 , 1 , 2 ], dtype = np . intp ))
563
564
tm .assert_numpy_array_equal (idx .get_indexer (target , 'nearest' ),
564
- np .array ([0 , 1 , 1 ]))
565
+ np .array ([0 , 1 , 1 ], dtype = np . intp ))
565
566
tm .assert_numpy_array_equal (
566
567
idx .get_indexer (target , 'nearest' ,
567
568
tolerance = pd .Timedelta ('1 hour' )),
568
- np .array ([0 , - 1 , 1 ]))
569
+ np .array ([0 , - 1 , 1 ], dtype = np . intp ))
569
570
with tm .assertRaises (ValueError ):
570
571
idx .get_indexer (idx [[0 ]], method = 'nearest' , tolerance = 'foo' )
571
572
@@ -872,27 +873,27 @@ def test_where_other(self):
872
873
def test_get_indexer (self ):
873
874
idx = pd .period_range ('2000-01-01' , periods = 3 ).asfreq ('H' , how = 'start' )
874
875
tm .assert_numpy_array_equal (idx .get_indexer (idx ),
875
- np .array ([0 , 1 , 2 ], dtype = np .int_ ))
876
+ np .array ([0 , 1 , 2 ], dtype = np .intp ))
876
877
877
878
target = pd .PeriodIndex (['1999-12-31T23' , '2000-01-01T12' ,
878
879
'2000-01-02T01' ], freq = 'H' )
879
880
tm .assert_numpy_array_equal (idx .get_indexer (target , 'pad' ),
880
- np .array ([- 1 , 0 , 1 ], dtype = np .int_ ))
881
+ np .array ([- 1 , 0 , 1 ], dtype = np .intp ))
881
882
tm .assert_numpy_array_equal (idx .get_indexer (target , 'backfill' ),
882
- np .array ([0 , 1 , 2 ], dtype = np .int_ ))
883
+ np .array ([0 , 1 , 2 ], dtype = np .intp ))
883
884
tm .assert_numpy_array_equal (idx .get_indexer (target , 'nearest' ),
884
- np .array ([0 , 1 , 1 ], dtype = np .int_ ))
885
+ np .array ([0 , 1 , 1 ], dtype = np .intp ))
885
886
tm .assert_numpy_array_equal (idx .get_indexer (target , 'nearest' ,
886
887
tolerance = '1 hour' ),
887
- np .array ([0 , - 1 , 1 ], dtype = np .int_ ))
888
+ np .array ([0 , - 1 , 1 ], dtype = np .intp ))
888
889
889
890
msg = 'Input has different freq from PeriodIndex\\ (freq=H\\ )'
890
891
with self .assertRaisesRegexp (ValueError , msg ):
891
892
idx .get_indexer (target , 'nearest' , tolerance = '1 minute' )
892
893
893
894
tm .assert_numpy_array_equal (idx .get_indexer (target , 'nearest' ,
894
895
tolerance = '1 day' ),
895
- np .array ([0 , 1 , 1 ], dtype = np .int_ ))
896
+ np .array ([0 , 1 , 1 ], dtype = np .intp ))
896
897
897
898
def test_repeat (self ):
898
899
# GH10183
@@ -1048,19 +1049,19 @@ def test_get_loc(self):
1048
1049
def test_get_indexer (self ):
1049
1050
idx = pd .to_timedelta (['0 days' , '1 days' , '2 days' ])
1050
1051
tm .assert_numpy_array_equal (idx .get_indexer (idx ),
1051
- np .array ([0 , 1 , 2 ], dtype = np .int_ ))
1052
+ np .array ([0 , 1 , 2 ], dtype = np .intp ))
1052
1053
1053
1054
target = pd .to_timedelta (['-1 hour' , '12 hours' , '1 day 1 hour' ])
1054
1055
tm .assert_numpy_array_equal (idx .get_indexer (target , 'pad' ),
1055
- np .array ([- 1 , 0 , 1 ], dtype = np .int_ ))
1056
+ np .array ([- 1 , 0 , 1 ], dtype = np .intp ))
1056
1057
tm .assert_numpy_array_equal (idx .get_indexer (target , 'backfill' ),
1057
- np .array ([0 , 1 , 2 ], dtype = np .int_ ))
1058
+ np .array ([0 , 1 , 2 ], dtype = np .intp ))
1058
1059
tm .assert_numpy_array_equal (idx .get_indexer (target , 'nearest' ),
1059
- np .array ([0 , 1 , 1 ], dtype = np .int_ ))
1060
+ np .array ([0 , 1 , 1 ], dtype = np .intp ))
1060
1061
1061
1062
res = idx .get_indexer (target , 'nearest' ,
1062
1063
tolerance = pd .Timedelta ('1 hour' ))
1063
- tm .assert_numpy_array_equal (res , np .array ([0 , - 1 , 1 ], dtype = np .int_ ))
1064
+ tm .assert_numpy_array_equal (res , np .array ([0 , - 1 , 1 ], dtype = np .intp ))
1064
1065
1065
1066
def test_numeric_compat (self ):
1066
1067
0 commit comments