Orange Forum • View topic - Modifying example table in memory

Modifying example table in memory

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

Modifying example table in memory

Postby NoLogon » Tue Aug 11, 2009 20:06

I'd like to change the attribute columns of an ExampleTable loaded from file to either "ignore" or "meta" while only loading the table once. Is this even possible?

I have looked at the ExampleTable.addMetaAttribute() method, but that appears to only add new columns to an existing table. Is that right?

Maybe I am approaching the problem incorrectly. I would like to experiment with the effects of leaving out an attribute, furthermore I would like to do this iteratively over all the available attributes. Is there a way to do this without duplicating the memory used?

Postby Janez » Tue Aug 11, 2009 21:18

There is. See ExampleTable.changeDomain on In short,

Code: Select all
d = orange.ExampleTable("iris")
dom2 = orange.Domain(d.domain.attributes[:2], d.domain.classVar)

Here I just removed two attributes, but you can also move them around, to meta attributes or whatever.

Use this very carefully. If other objects hold the reference to this same table and you change it, they may be rather surprised.

Postby NoLogon » Wed Aug 12, 2009 17:08

Thanks, Janez. I'll check this out.

- Scott

Return to Questions & Support