Last active
March 14, 2018 00:48
-
-
Save ubershmekel/4379508 to your computer and use it in GitHub Desktop.
Remove certain rows from orange-canvas data with a python node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Orange | |
bad_list = [ | |
'abc', | |
'bcd', | |
] | |
id_index = in_data.domain.index('the_col_id') | |
out_data = Orange.data.Table(in_data) | |
# reversed so that the indexing is consistent after deletion | |
for i, row in reversed(list(enumerate(in_data))): | |
val = row[id_index].value | |
if val in bad_list: | |
del out_data[i] | |
print 'in/out', len(in_data), len(out_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment