Skip to content

Commit 3117f78

Browse files
gfyoungjreback
authored andcommitted
TST: Test .loc with uint64 numbers (#23879)
Closes gh-19399.
1 parent a37b3e2 commit 3117f78

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

pandas/tests/frame/test_indexing.py

+12
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,18 @@ def test_getitem_listlike(self, idx_type, levels):
132132
with pytest.raises(KeyError, match='not in index'):
133133
frame[idx]
134134

135+
@pytest.mark.parametrize("val,expected", [
136+
(2**63 - 1, Series([1])),
137+
(2**63, Series([2])),
138+
])
139+
def test_loc_uint64(self, val, expected):
140+
# see gh-19399
141+
df = DataFrame([1, 2], index=[2**63 - 1, 2**63])
142+
result = df.loc[val]
143+
144+
expected.name = val
145+
tm.assert_series_equal(result, expected)
146+
135147
def test_getitem_callable(self):
136148
# GH 12533
137149
result = self.frame[lambda x: 'A']

pandas/tests/series/indexing/test_loc.py

+10
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
from pandas.util.testing import assert_series_equal
1212

1313

14+
@pytest.mark.parametrize("val,expected", [
15+
(2**63 - 1, 3),
16+
(2**63, 4),
17+
])
18+
def test_loc_uint64(val, expected):
19+
# see gh-19399
20+
s = Series({2**63 - 1: 3, 2**63: 4})
21+
assert s.loc[val] == expected
22+
23+
1424
def test_loc_getitem(test_data):
1525
inds = test_data.series.index[[3, 4, 7]]
1626
assert_series_equal(

0 commit comments

Comments
 (0)