@@ -515,17 +515,20 @@ def f():
515
515
def test_argsort (self ):
516
516
c = Categorical ([5 , 3 , 1 , 4 , 2 ], ordered = True )
517
517
518
- expected = np .array ([2 , 4 , 1 , 3 , 0 ], dtype = np .int64 )
519
- tm .assert_numpy_array_equal (c .argsort (ascending = True ), expected )
518
+ expected = np .array ([2 , 4 , 1 , 3 , 0 ])
519
+ tm .assert_numpy_array_equal (c .argsort (ascending = True ), expected ,
520
+ check_dtype = False )
520
521
521
522
expected = expected [::- 1 ]
522
- tm .assert_numpy_array_equal (c .argsort (ascending = False ), expected )
523
+ tm .assert_numpy_array_equal (c .argsort (ascending = False ), expected ,
524
+ check_dtype = False )
523
525
524
526
def test_numpy_argsort (self ):
525
527
c = Categorical ([5 , 3 , 1 , 4 , 2 ], ordered = True )
526
528
527
- expected = np .array ([2 , 4 , 1 , 3 , 0 ], dtype = np .int64 )
528
- tm .assert_numpy_array_equal (np .argsort (c ), expected )
529
+ expected = np .array ([2 , 4 , 1 , 3 , 0 ])
530
+ tm .assert_numpy_array_equal (np .argsort (c ), expected ,
531
+ check_dtype = False )
529
532
530
533
msg = "the 'kind' parameter is not supported"
531
534
tm .assertRaisesRegexp (ValueError , msg , np .argsort ,
@@ -1505,7 +1508,7 @@ def test_searchsorted(self):
1505
1508
# Single item array
1506
1509
res = c1 .searchsorted (['bread' ])
1507
1510
chk = s1 .searchsorted (['bread' ])
1508
- exp = np .array ([1 ], dtype = np .int64 )
1511
+ exp = np .array ([1 ], dtype = np .intp )
1509
1512
self .assert_numpy_array_equal (res , exp )
1510
1513
self .assert_numpy_array_equal (res , chk )
1511
1514
@@ -1514,21 +1517,21 @@ def test_searchsorted(self):
1514
1517
# np.array.searchsorted()
1515
1518
res = c1 .searchsorted ('bread' )
1516
1519
chk = s1 .searchsorted ('bread' )
1517
- exp = np .array ([1 ], dtype = np .int64 )
1520
+ exp = np .array ([1 ], dtype = np .intp )
1518
1521
self .assert_numpy_array_equal (res , exp )
1519
1522
self .assert_numpy_array_equal (res , chk )
1520
1523
1521
1524
# Searching for a value that is not present in the Categorical
1522
1525
res = c1 .searchsorted (['bread' , 'eggs' ])
1523
1526
chk = s1 .searchsorted (['bread' , 'eggs' ])
1524
- exp = np .array ([1 , 4 ], dtype = np .int64 )
1527
+ exp = np .array ([1 , 4 ], dtype = np .intp )
1525
1528
self .assert_numpy_array_equal (res , exp )
1526
1529
self .assert_numpy_array_equal (res , chk )
1527
1530
1528
1531
# Searching for a value that is not present, to the right
1529
1532
res = c1 .searchsorted (['bread' , 'eggs' ], side = 'right' )
1530
1533
chk = s1 .searchsorted (['bread' , 'eggs' ], side = 'right' )
1531
- exp = np .array ([3 , 4 ], dtype = np .int64 ) # eggs before milk
1534
+ exp = np .array ([3 , 4 ], dtype = np .intp ) # eggs before milk
1532
1535
self .assert_numpy_array_equal (res , exp )
1533
1536
self .assert_numpy_array_equal (res , chk )
1534
1537
@@ -1538,7 +1541,7 @@ def test_searchsorted(self):
1538
1541
chk = s2 .searchsorted (['bread' , 'eggs' ], side = 'right' ,
1539
1542
sorter = [0 , 1 , 2 , 3 , 5 , 4 ])
1540
1543
# eggs after donuts, after switching milk and donuts
1541
- exp = np .array ([3 , 5 ], dtype = np .int64 )
1544
+ exp = np .array ([3 , 5 ], dtype = np .intp )
1542
1545
self .assert_numpy_array_equal (res , exp )
1543
1546
self .assert_numpy_array_equal (res , chk )
1544
1547
0 commit comments