Skip to content

BUG: Use correct ExtensionArray reductions in DataFrame reductions #35254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 15, 2020
Prev Previous commit
Next Next commit
add test to ensure EA op is used for integer array
  • Loading branch information
jorisvandenbossche committed Jul 15, 2020
commit 9ee96691cc6f061cbda79920b7e58c86fd9c35d7
9 changes: 9 additions & 0 deletions pandas/tests/arrays/integer/test_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,15 @@ def test_mixed_frame_with_integer_sum():
tm.assert_series_equal(result, expected)


@pytest.mark.parametrize("op", ["sum", "prod", "min", "max"])
def test_dataframe_reductions(op):
# https://github.com/pandas-dev/pandas/pull/32867
# ensure the integers are not cast to float during reductions
df = pd.DataFrame({"a": pd.array([1, 2], dtype="Int64")})
result = df.max()
assert isinstance(result["a"], np.int64)


# TODO(jreback) - these need testing / are broken

# shift
Expand Down