Skip to content

Commit fc80938

Browse files
committed
adjust for 32bit
1 parent 84f38b2 commit fc80938

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

pandas/indexes/base.py

+4
Original file line numberDiff line numberDiff line change
@@ -2859,6 +2859,8 @@ def _get_leaf_sorter(labels):
28592859
left_indexer, right_indexer = right_indexer, left_indexer
28602860

28612861
if return_indexers:
2862+
left_indexer = None if left_indexer is None else _ensure_platform_int(left_indexer)
2863+
right_indexer = None if right_indexer is None else _ensure_platform_int(right_indexer)
28622864
return join_index, left_indexer, right_indexer
28632865
else:
28642866
return join_index
@@ -2902,6 +2904,8 @@ def _join_monotonic(self, other, how='left', return_indexers=False):
29022904
join_index = self._wrap_joined_index(join_index, other)
29032905

29042906
if return_indexers:
2907+
lidx = None if lidx is None else _ensure_platform_int(lidx)
2908+
ridx = None if ridx is None else _ensure_platform_int(ridx)
29052909
return join_index, lidx, ridx
29062910
else:
29072911
return join_index

pandas/tests/frame/test_operators.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ def test_alignment_non_pandas(self):
11961196

11971197
align = pd.core.ops._align_method_FRAME
11981198

1199-
for val in [[1, 2, 3], (1, 2, 3), np.array([1, 2, 3], dtype=np.intp)]:
1199+
for val in [[1, 2, 3], (1, 2, 3), np.array([1, 2, 3], dtype=np.int64)]:
12001200

12011201
tm.assert_series_equal(align(df, val, 'index'),
12021202
Series([1, 2, 3], index=df.index))

pandas/tests/indexes/test_multi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,7 @@ def test_join_multi(self):
17371737
# keep MultiIndex
17381738
jidx, lidx, ridx = midx.join(idx, how='left', return_indexers=True)
17391739
exp_ridx = np.array([-1, 0, 1, -1, -1, 0, 1, -1, -1, 0, 1, -1, -1, 0,
1740-
1, -1], dtype=np.int64)
1740+
1, -1], dtype=np.intp)
17411741
self.assert_index_equal(jidx, midx)
17421742
self.assertIsNone(lidx)
17431743
self.assert_numpy_array_equal(ridx, exp_ridx)

pandas/tests/indexes/test_numeric.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,8 @@ def test_join_inner(self):
642642
res2 = self.index.intersection(other_mono)
643643
self.assert_index_equal(res, res2)
644644

645-
elidx = np.array([1, 6], dtype=np.int64)
646-
eridx = np.array([1, 4], dtype=np.int64)
645+
elidx = np.array([1, 6], dtype=np.intp)
646+
eridx = np.array([1, 4], dtype=np.intp)
647647
tm.assertIsInstance(res, Int64Index)
648648
self.assert_index_equal(res, eres)
649649
tm.assert_numpy_array_equal(lidx, elidx)
@@ -680,8 +680,8 @@ def test_join_left(self):
680680
idx2 = Index([1, 2, 5, 7, 9])
681681
res, lidx, ridx = idx2.join(idx, how='left', return_indexers=True)
682682
eres = Index([1, 1, 2, 5, 7, 9]) # 1 is in idx2, so it should be x2
683-
eridx = np.array([0, 1, 2, 3, -1, -1], dtype=np.int64)
684-
elidx = np.array([0, 0, 1, 2, 3, 4], dtype=np.int64)
683+
eridx = np.array([0, 1, 2, 3, -1, -1], dtype=np.intp)
684+
elidx = np.array([0, 0, 1, 2, 3, 4], dtype=np.intp)
685685
self.assert_index_equal(res, eres)
686686
tm.assert_numpy_array_equal(lidx, elidx)
687687
tm.assert_numpy_array_equal(ridx, eridx)
@@ -705,7 +705,7 @@ def test_join_right(self):
705705
res, lidx, ridx = self.index.join(other_mono, how='right',
706706
return_indexers=True)
707707
eres = other_mono
708-
elidx = np.array([-1, 1, -1, -1, 6, -1], dtype=np.int64)
708+
elidx = np.array([-1, 1, -1, -1, 6, -1], dtype=np.intp)
709709
tm.assertIsInstance(other, Int64Index)
710710
self.assert_index_equal(res, eres)
711711
tm.assert_numpy_array_equal(lidx, elidx)
@@ -716,8 +716,8 @@ def test_join_right(self):
716716
idx2 = Index([1, 2, 5, 7, 9])
717717
res, lidx, ridx = idx.join(idx2, how='right', return_indexers=True)
718718
eres = Index([1, 1, 2, 5, 7, 9]) # 1 is in idx2, so it should be x2
719-
elidx = np.array([0, 1, 2, 3, -1, -1], dtype=np.int64)
720-
eridx = np.array([0, 0, 1, 2, 3, 4], dtype=np.int64)
719+
elidx = np.array([0, 1, 2, 3, -1, -1], dtype=np.intp)
720+
eridx = np.array([0, 0, 1, 2, 3, 4], dtype=np.intp)
721721
self.assert_index_equal(res, eres)
722722
tm.assert_numpy_array_equal(lidx, elidx)
723723
tm.assert_numpy_array_equal(ridx, eridx)

0 commit comments

Comments
 (0)