-
-
Notifications
You must be signed in to change notification settings - Fork 17.8k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -433,15 +433,22 @@ def test_agg_over_numpy_arrays(): | |
], | ||
columns=["category", "arraydata"], | ||
) | ||
result = df.groupby("category").agg(sum) | ||
gb = df.groupby("category") | ||
|
||
expected_data = [[np.array([50, 70, 90])], [np.array([20, 30, 40])]] | ||
expected_index = Index([1, 2], name="category") | ||
expected_column = ["arraydata"] | ||
expected = DataFrame(expected_data, index=expected_index, columns=expected_column) | ||
|
||
alt = gb.sum(numeric_only=False) | ||
tm.assert_frame_equal(alt, expected) | ||
|
||
result = gb.agg("sum", numeric_only=False) | ||
tm.assert_frame_equal(result, expected) | ||
|
||
# FIXME: the original version of this test called `gb.agg(sum)` | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rhshadrach
Member
|
||
# and that raises TypeError if `numeric_only=False` is passed | ||
|
||
|
||
@pytest.mark.parametrize("as_period", [True, False]) | ||
def test_agg_tzaware_non_datetime_result(as_period): | ||
|
@@ -524,9 +531,14 @@ def test_sum_uint64_overflow(): | |
) | ||
|
||
expected.index.name = 0 | ||
result = df.groupby(0).sum() | ||
result = df.groupby(0).sum(numeric_only=False) | ||
tm.assert_frame_equal(result, expected) | ||
|
||
# out column is non-numeric, so with numeric_only=True it is dropped | ||
result2 = df.groupby(0).sum(numeric_only=True) | ||
expected2 = expected[[]] | ||
tm.assert_frame_equal(result2, expected2) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"structure, expected", | ||
|
@rhshadrach shot in the dark: any idea how/if to address this?