mike
mike

Reputation: 55

Orange3 : String Variable

I do not manage to create an Orange table with StringVariables. The following code:

d = Orange.data.Domain([Orange.data.StringVariable("s")])

makes this error:

TypeError: variables must be primitive

It seems that StringVariable is for metadata only. So I'm worried about this because my data has a lot of strings that it would be crazy to put in a discrete structure (each string value is different). Is there a solution for putting strings in a table ?

Thanks in advance for the answers, Best, mike

Upvotes: 1

Views: 1360

Answers (1)

PeterT
PeterT

Reputation: 8284

This question might be old but I found it via Google and wanted to provide a simple example of how to use meta "columns".

You need to specify the meta variables the same way you specify the "normal" variables just do it inside the metas parameter inside the Domain constructor.

from Orange.data import *

taskid = StringVariable(name="taskid")
logdata = StringVariable(name="logdata")

domain = Domain([] , metas=[taskid, logdata])

data = Table(domain, [
["uuid1","some more stuff"],
["uuid2","some more stuff"]
]);

out_data = data;

Upvotes: 0

Related Questions