@@ -295,7 +295,8 @@ def from_table(cls, domain, source, row_indices=...):
295295
296296 global _conversion_cache
297297
298- def get_columns (row_indices , src_cols , n_rows , dtype = np .float64 , is_sparse = False ):
298+ def get_columns (row_indices , src_cols , n_rows , dtype = np .float64 ,
299+ is_sparse = False , variables = []):
299300 if not len (src_cols ):
300301 if is_sparse :
301302 return sp .csr_matrix ((n_rows , 0 ), dtype = source .X .dtype )
@@ -331,7 +332,7 @@ def get_columns(row_indices, src_cols, n_rows, dtype=np.float64, is_sparse=False
331332 shared_cache = _conversion_cache
332333 for i , col in enumerate (src_cols ):
333334 if col is None :
334- a [:, i ] = Unknown
335+ a [:, i ] = variables [ i ]. Unknown
335336 elif not isinstance (col , Integral ):
336337 if isinstance (col , SharedComputeValue ):
337338 if (id (col .compute_shared ), id (source )) not in shared_cache :
@@ -394,19 +395,22 @@ def get_columns(row_indices, src_cols, n_rows, dtype=np.float64, is_sparse=False
394395 self .domain = domain
395396 conversion = domain .get_conversion (source .domain )
396397 self .X = get_columns (row_indices , conversion .attributes , n_rows ,
397- is_sparse = conversion .sparse_X )
398+ is_sparse = conversion .sparse_X ,
399+ variables = domain .attributes )
398400 if self .X .ndim == 1 :
399401 self .X = self .X .reshape (- 1 , len (self .domain .attributes ))
400402
401403 self .Y = get_columns (row_indices , conversion .class_vars , n_rows ,
402- is_sparse = conversion .sparse_Y )
404+ is_sparse = conversion .sparse_Y ,
405+ variables = domain .class_vars )
403406
404407 dtype = np .float64
405408 if any (isinstance (var , StringVariable ) for var in domain .metas ):
406409 dtype = np .object
407410 self .metas = get_columns (row_indices , conversion .metas ,
408411 n_rows , dtype ,
409- is_sparse = conversion .sparse_metas )
412+ is_sparse = conversion .sparse_metas ,
413+ variables = domain .metas )
410414 if self .metas .ndim == 1 :
411415 self .metas = self .metas .reshape (- 1 , len (self .domain .metas ))
412416 if source .has_weights ():
0 commit comments