Skip to content

Commit 0596d3e

Browse files
committed
TST: Add test for loc with large uint64 index
1 parent 68f6b90 commit 0596d3e

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

pandas/tests/indexing/test_loc.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,3 +784,32 @@ def convert_nested_indexer(indexer_type, keys):
784784
index=pd.MultiIndex.from_product(keys))
785785

786786
tm.assert_series_equal(result, expected)
787+
788+
def test_loc_uint64(self):
789+
# GH20722
790+
# Test whether loc accept uint64 max value as index.
791+
s = pd.Series(
792+
[1, 2],
793+
index=[
794+
np.iinfo('uint64').max - 1,
795+
np.iinfo('uint64').max
796+
]
797+
)
798+
exp1 = pd.Series(
799+
[1],
800+
index=[
801+
18446744073709551614
802+
]
803+
)
804+
exp2 = pd.Series(
805+
[2],
806+
index=[
807+
18446744073709551615
808+
]
809+
)
810+
811+
tm.assert_series_equal(s.loc[[np.iinfo('uint64').max - 1]], exp1)
812+
assert 1 == s.loc[np.iinfo('uint64').max - 1]
813+
814+
tm.assert_series_equal(s.loc[[np.iinfo('uint64').max]], exp2)
815+
assert 2 == s.loc[np.iinfo('uint64').max]

0 commit comments

Comments
 (0)