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

Function test_table_drop

python/pyarrow/tests/test_table.py:1796–1813  ·  view source on GitHub ↗

verify the alias of drop_columns is working

()

Source from the content-addressed store, hash-verified

1794
1795
1796def test_table_drop():
1797 """ verify the alias of drop_columns is working"""
1798 a = pa.array(range(5))
1799 b = pa.array([-10, -5, 0, 5, 10])
1800 c = pa.array(range(5, 10))
1801
1802 table = pa.Table.from_arrays([a, b, c], names=('a', 'b', 'c'))
1803 t2 = table.drop(['a', 'b'])
1804 t3 = table.drop('a')
1805
1806 exp_t2 = pa.Table.from_arrays([c], names=('c',))
1807 assert exp_t2.equals(t2)
1808 exp_t3 = pa.Table.from_arrays([b, c], names=('b', 'c',))
1809 assert exp_t3.equals(t3)
1810
1811 # -- raise KeyError if column not in Table
1812 with pytest.raises(KeyError, match="Column 'd' not found"):
1813 table.drop(['d'])
1814
1815
1816@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 2

equalsMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected