Skip to content

BUG: Bug in sum of a timedelta64[ns] series (GH6462) #6475

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 1 commit into from
Feb 25, 2014
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions doc/source/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ Bug Fixes
- Bug in ``str.extract`` when passed a non-default index (:issue:`6348`)
- Bug in ``str.split`` when passed ``pat=None`` and ``n=1`` (:issue:`6466`)
- Bug in ``io.data.DataReader`` when passed ``"F-F_Momentum_Factor"`` and ``data_source="famafrench"`` (:issue:`6460`)
- Bug in ``sum`` of a ``timedelta64[ns]`` series (:issue:`6462`)

pandas 0.13.1
-------------
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/nanops.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ def nansum(values, axis=None, skipna=True):
values, mask, dtype = _get_values(values, skipna, 0)
the_sum = values.sum(axis)
the_sum = _maybe_null_out(the_sum, axis, mask)
return the_sum

return _wrap_results(the_sum, dtype)


@disallow('M8')
Expand Down
6 changes: 6 additions & 0 deletions pandas/tseries/tests/test_timedeltas.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ def test_timedelta_ops(self):
expected = to_timedelta('00:00:08')
tm.assert_almost_equal(result, expected)

# GH 6462
# consistency in returned values for sum
result = td.sum()[0]
expected = to_timedelta('00:01:21')
tm.assert_almost_equal(result, expected)

def test_to_timedelta_on_missing_values(self):
_skip_if_numpy_not_friendly()

Expand Down