Skip to content

Commit

Permalink
TST: Add test for large integer result in groupby.prod (#56384)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccccjone authored Dec 9, 2023
1 parent 04307e7 commit ebde354
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pandas/tests/groupby/test_reductions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,3 +1057,27 @@ def test_regression_allowlist_methods(op, axis, skipna, sort):
if sort:
expected = expected.sort_index(axis=axis)
tm.assert_frame_equal(result, expected)


def test_groupby_prod_with_int64_dtype():
# GH#46573
data = [
[1, 11],
[1, 41],
[1, 17],
[1, 37],
[1, 7],
[1, 29],
[1, 31],
[1, 2],
[1, 3],
[1, 43],
[1, 5],
[1, 47],
[1, 19],
[1, 88],
]
df = DataFrame(data, columns=["A", "B"], dtype="int64")
result = df.groupby(["A"]).prod().reset_index()
expected = DataFrame({"A": [1], "B": [180970905912331920]}, dtype="int64")
tm.assert_frame_equal(result, expected)

0 comments on commit ebde354

Please sign in to comment.