Skip to content

Commit

Permalink
TST verify groupby doesn't alter unit64s to floats pandas-dev#30859 (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Dickson authored and Kevin D Smith committed Nov 2, 2020
1 parent 1156ca7 commit 5916ecc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pandas/tests/groupby/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,18 @@ def test_groupby_dtype_inference_empty():
tm.assert_frame_equal(result, expected, by_blocks=True)


def test_groupby_unit64_float_conversion():
#  GH: 30859 groupby converts unit64 to floats sometimes
df = pd.DataFrame({"first": [1], "second": [1], "value": [16148277970000000000]})
result = df.groupby(["first", "second"])["value"].max()
expected = pd.Series(
[16148277970000000000],
pd.MultiIndex.from_product([[1], [1]], names=["first", "second"]),
name="value",
)
tm.assert_series_equal(result, expected)


def test_groupby_list_infer_array_like(df):
result = df.groupby(list(df["A"])).mean()
expected = df.groupby(df["A"]).mean()
Expand Down

0 comments on commit 5916ecc

Please sign in to comment.