Orange Forum • View topic - Ignoring an attribute

Ignoring an attribute

A place to ask questions about methods in Orange and how they are used and other general support.

Ignoring an attribute

Postby garyspatterson » Sun Mar 04, 2012 23:29

Hi there
What script could I use in Python to ignore a particular attribute (or attributes) after a table has been read in? Using Canvas, I can do this easily using the Select Attributes widget. But I cannot see a simple explanation in the tutorial or in the references to how to accomplish this using scripting. There is a similar previous question in the Q&A forum, but the link you provided with an explanation is no longer active.
Thanks...

Re: Ignoring an attribute

Postby Ales » Tue Mar 06, 2012 10:10

Basically you have to construct a new Domain instance with your selected features and then create a new Table from your old data with this new domain. Example:
Code: Select all
import Orange
data = Orange.data.Table("iris")
# A new domain with only the first two features
new_domain = Orange.data.Domain(list(data.domain)[:2], data.domain.class_var)
# And the new data table
new_data = Orange.data.Table(new_domain, data)

See also the documentation for Orange.data.Table http://orange.biolab.si/doc/reference/Orange.data.table/ and domain http://orange.biolab.si/doc/reference/Orange.data.domain/

Re: Ignoring an attribute

Postby garyspatterson » Wed Mar 07, 2012 5:11

I see, thanks...


Return to Questions & Support