setdiff¶
-
astropy.table.
setdiff
(table1, table2, keys=None)[source] [edit on github]¶ Take a set difference of table rows.
The row set difference will contain all rows in
table1
that are not present intable2
. If the keys parameter is not defined, all columns intable1
will be included in the output table.Parameters: Returns: - diff_table :
Table
New table containing the set difference between tables. If the set difference is none, an empty table will be returned.
Examples
To get a set difference between two tables:
>>> from astropy.table import setdiff, Table >>> t1 = Table({'a': [1, 4, 9], 'b': ['c', 'd', 'f']}, names=('a', 'b')) >>> t2 = Table({'a': [1, 5, 9], 'b': ['c', 'b', 'f']}, names=('a', 'b')) >>> print(t1) a b --- --- 1 c 4 d 9 f >>> print(t2) a b --- --- 1 c 5 b 9 f >>> print(setdiff(t1, t2)) a b --- --- 4 d >>> print(setdiff(t2, t1)) a b --- --- 5 b
- diff_table :