| 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/indexes/timedeltas/methods/ |
Upload File : |
from pandas import (
Index,
NaT,
Timedelta,
TimedeltaIndex,
)
import pandas._testing as tm
class TestFillNA:
def test_fillna_timedelta(self):
# GH#11343
idx = TimedeltaIndex(["1 day", NaT, "3 day"])
exp = TimedeltaIndex(["1 day", "2 day", "3 day"])
tm.assert_index_equal(idx.fillna(Timedelta("2 day")), exp)
exp = TimedeltaIndex(["1 day", "3 hour", "3 day"])
idx.fillna(Timedelta("3 hour"))
exp = Index([Timedelta("1 day"), "x", Timedelta("3 day")], dtype=object)
tm.assert_index_equal(idx.fillna("x"), exp)