- craftutils.wrap.dragons.Table.remove_rows(row_specifier)
Remove rows from the table.
Parameters¶
- row_specifierslice or int or array of int
Specification for rows to remove
Examples¶
Create a table with three columns ‘a’, ‘b’ and ‘c’:
>>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']], ... names=('a', 'b', 'c')) >>> print(t) a b c --- --- --- 1 0.1 x 2 0.2 y 3 0.3 zRemove rows 0 and 2 from the table:
>>> t.remove_rows([0, 2]) >>> print(t) a b c --- --- --- 2 0.2 yNote that there are no warnings if the slice operator extends outside the data:
>>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']], ... names=('a', 'b', 'c')) >>> t.remove_rows(slice(10, 20, 1)) >>> print(t) a b c --- --- --- 1 0.1 x 2 0.2 y 3 0.3 z