Skip to content

Commit 34f78a7

Browse files
committed
Table: Consider sparsity flags when domain match
1 parent e06b88d commit 34f78a7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Orange/data/table.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,12 @@ def get_columns(row_indices, src_cols, n_rows, dtype=np.float64, is_sparse=False
398398
table = cls.from_table_rows(source, row_indices)
399399
# assure resulting domain is the instance passed on input
400400
table.domain = domain
401+
# Since sparse flags are not considered when checking for domain equality,
402+
# we need to assure correct density manually through domain conversion suggestions.
403+
conversion = domain.get_conversion(source.domain)
404+
table.X = array_transform(table.X, conversion.sparse_X)
405+
table.Y = array_transform(table.Y, conversion.sparse_Y)
406+
table.metas = array_transform(table.metas, conversion.sparse_metas)
401407
return table
402408

403409
if isinstance(row_indices, slice):

0 commit comments

Comments
 (0)