MCPcopy Create free account
hub / github.com/apache/arrow / test_table_set_column

Function test_table_set_column

python/pyarrow/tests/test_table.py:1751–1766  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

1749 ]
1750)
1751def test_table_set_column(cls):
1752 data = [
1753 pa.array(range(5)),
1754 pa.array([-10, -5, 0, 5, 10]),
1755 pa.array(range(5, 10))
1756 ]
1757 table = cls.from_arrays(data, names=('a', 'b', 'c'))
1758
1759 new_field = pa.field('d', data[1].type)
1760 t2 = table.set_column(0, new_field, data[1])
1761
1762 expected_data = list(data)
1763 expected_data[0] = data[1]
1764 expected = cls.from_arrays(expected_data,
1765 names=('d', 'b', 'c'))
1766 assert t2.equals(expected)
1767
1768
1769@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

listFunction · 0.85
equalsMethod · 0.80
arrayMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected