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

Method test_set

pandas/tests/internals/test_internals.py:447–459  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

445 tm.assert_almost_equal(mgr.iget(2).internal_values(), values[2])
446
447 def test_set(self):
448 mgr = create_mgr("a,b,c: int", item_shape=(3,))
449
450 mgr.insert(len(mgr.items), "d", np.array(["foo"] * 3))
451 mgr.iset(1, np.array(["bar"] * 3))
452 tm.assert_numpy_array_equal(mgr.iget(0).internal_values(), np.array([0] * 3))
453 tm.assert_numpy_array_equal(
454 mgr.iget(1).internal_values(), np.array(["bar"] * 3, dtype=np.object_)
455 )
456 tm.assert_numpy_array_equal(mgr.iget(2).internal_values(), np.array([2] * 3))
457 tm.assert_numpy_array_equal(
458 mgr.iget(3).internal_values(), np.array(["foo"] * 3, dtype=np.object_)
459 )
460
461 def test_set_change_dtype(self, mgr):
462 mgr.insert(len(mgr.items), "baz", np.zeros(N, dtype=bool))

Callers

nothing calls this directly

Calls 6

create_mgrFunction · 0.85
isetMethod · 0.80
internal_valuesMethod · 0.80
insertMethod · 0.45
arrayMethod · 0.45
igetMethod · 0.45

Tested by

no test coverage detected