Skip to content

Commit bd783f3

Browse files
committed
transformation.Transformation: Fix for transformation of non-primitive attributes
1 parent 050004c commit bd783f3

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Orange/preprocess/transformation.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,17 @@ def __call__(self, data):
2424
inst = isinstance(data, Instance)
2525
if inst:
2626
data = Table(data.domain, [data])
27-
domain = Domain([self.variable])
28-
data = Table.from_table(domain, data)
29-
transformed = self.transform(data.X if sp.issparse(data.X) else data.X.squeeze(axis=1))
27+
if self.variable.is_primitive():
28+
domain = Domain([self.variable])
29+
data = Table.from_table(domain, data)
30+
col = data.X
31+
else:
32+
domain = Domain([], metas=[self.variable])
33+
data = Table.from_table(domain, data)
34+
col = data.metas
35+
if sp.issparse(col):
36+
col = col.squeeze(axis=1)
37+
transformed = self.transform(col)
3038
if inst:
3139
transformed = transformed[0]
3240
return transformed

0 commit comments

Comments
 (0)