Skip to content

TST: GH 27185 Test to check df with timedelta & Int NA sums correctly #47354

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 3 commits into from
Jun 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pandas/tests/reductions/test_reductions.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,18 @@ def test_numpy_reduction_with_tz_aware_dtype(self, tz_aware_fixture, func):
result = getattr(np, func)(expected, expected)
tm.assert_series_equal(result, expected)

def test_nan_int_timedelta_sum(self):
# GH 27185
df = DataFrame(
{
"A": Series([1, 2, NaT], dtype="timedelta64[ns]"),
"B": Series([1, 2, np.nan], dtype="Int64"),
}
)
expected = Series({"A": Timedelta(3), "B": 3})
result = df.sum()
tm.assert_series_equal(result, expected)


class TestIndexReductions:
# Note: the name TestIndexReductions indicates these tests
Expand Down