Skip to content

Commit

Permalink
TST: Add test for groupby sum of large ints (#16671)
Browse files Browse the repository at this point in the history
Closes gh-14758.
  • Loading branch information
gfyoung authored and jreback committed Jun 12, 2017
1 parent 0281886 commit b72519e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pandas/tests/groupby/test_aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,3 +865,20 @@ def test_agg_timezone_round_trip(self):
ts = df['B'].iloc[2]
assert ts == grouped.last()['B'].iloc[0]
assert ts == grouped.apply(lambda x: x.iloc[-1])[0]

def test_sum_uint64_overflow(self):
# see gh-14758

# Convert to uint64 and don't overflow
df = pd.DataFrame([[1, 2], [3, 4], [5, 6]],
dtype=object) + 9223372036854775807

index = pd.Index([9223372036854775808, 9223372036854775810,
9223372036854775812], dtype=np.uint64)
expected = pd.DataFrame({1: [9223372036854775809,
9223372036854775811,
9223372036854775813]}, index=index)

expected.index.name = 0
result = df.groupby(0).sum()
tm.assert_frame_equal(result, expected)

0 comments on commit b72519e

Please sign in to comment.