| 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/copy_view/index/ |
Upload File : |
import pytest
from pandas import (
Series,
Timedelta,
TimedeltaIndex,
timedelta_range,
)
import pandas._testing as tm
pytestmark = pytest.mark.filterwarnings(
"ignore:Setting a value on a view:FutureWarning"
)
@pytest.mark.parametrize(
"cons",
[
lambda x: TimedeltaIndex(x),
lambda x: TimedeltaIndex(TimedeltaIndex(x)),
],
)
def test_timedeltaindex(using_copy_on_write, cons):
dt = timedelta_range("1 day", periods=3)
ser = Series(dt)
idx = cons(ser)
expected = idx.copy(deep=True)
ser.iloc[0] = Timedelta("5 days")
if using_copy_on_write:
tm.assert_index_equal(idx, expected)