Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] [FIX] OWMergeData removes table meta attributes #3336

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Orange/canvas/application/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def __init__(self, argv):
if hasattr(Qt, "AA_EnableHighDpiScaling"):
# Turn on HighDPI support when available
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)

QApplication.__init__(self, argv)
self.setAttribute(Qt.AA_DontShowIconsInMenus, True)

Expand Down
6 changes: 4 additions & 2 deletions Orange/data/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def from_table_rows(cls, source, row_indices):
return self

@classmethod
def from_numpy(cls, domain, X, Y=None, metas=None, W=None):
def from_numpy(cls, domain, X, Y=None, metas=None, W=None, data_attributes=None):
"""
Construct a table from numpy arrays with the given domain. The number
of variables in the domain must match the number of columns in the
Expand All @@ -482,6 +482,8 @@ def from_numpy(cls, domain, X, Y=None, metas=None, W=None):
:type metas: np.array
:param W: array with weights
:type W: np.array
:param data_attributes: dictionary of data attributes
:type data_attributes: OrderedDict
:return:
"""
X, Y, W = _check_arrays(X, Y, W, dtype='float64')
Expand Down Expand Up @@ -532,7 +534,7 @@ def from_numpy(cls, domain, X, Y=None, metas=None, W=None):
self.W = W
self.n_rows = self.X.shape[0]
cls._init_ids(self)
self.attributes = {}
self.attributes = data_attributes
return self

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/data/owmergedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def _join_table_by_indices(self, reduced_extra, indices):
string_cols = [i for i, var in enumerate(domain.metas) if var.is_string]
metas = self._join_array_by_indices(
self.data.metas, reduced_extra.metas, indices, string_cols)
return Orange.data.Table.from_numpy(domain, X, Y, metas)
return Orange.data.Table.from_numpy(domain, X, Y, metas, data_attributes = getattr(self.data, "attributes"))

@staticmethod
def _join_array_by_indices(left, right, indices, string_cols=None):
Expand Down