MCPcopy
hub / github.com/pandas-dev/pandas / test_isetitem

Function test_isetitem

pandas/tests/copy_view/test_methods.py:1280–1290  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1278
1279
1280def test_isetitem():
1281 df = DataFrame({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]})
1282 df_orig = df.copy()
1283 df2 = df.copy(deep=False) # Trigger a CoW
1284 df2.isetitem(1, np.array([-1, -2, -3])) # This is inplace
1285 assert np.shares_memory(get_array(df, "c"), get_array(df2, "c"))
1286 assert np.shares_memory(get_array(df, "a"), get_array(df2, "a"))
1287
1288 df2.loc[0, "a"] = 0
1289 tm.assert_frame_equal(df, df_orig) # Original is unchanged
1290 assert np.shares_memory(get_array(df, "c"), get_array(df2, "c"))
1291
1292
1293@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 5

DataFrameClass · 0.90
get_arrayFunction · 0.90
isetitemMethod · 0.80
copyMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected