| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Python312/Lib/site-packages/pandas/tests/arrays/timedeltas/ |
Upload File : |
import pytest
import pandas._testing as tm
from pandas.core.arrays import TimedeltaArray
class TestAccumulator:
def test_accumulators_disallowed(self):
# GH#50297
arr = TimedeltaArray._from_sequence(["1D", "2D"], dtype="m8[ns]")
with pytest.raises(TypeError, match="cumprod not supported"):
arr._accumulate("cumprod")
def test_cumsum(self, unit):
# GH#50297
dtype = f"m8[{unit}]"
arr = TimedeltaArray._from_sequence(["1D", "2D"], dtype=dtype)
result = arr._accumulate("cumsum")
expected = TimedeltaArray._from_sequence(["1D", "3D"], dtype=dtype)
tm.assert_timedelta_array_equal(result, expected)