Skip to content

Commit

Permalink
owfeatureconstructor: Remove iteration over rows in check_attrs_values
Browse files Browse the repository at this point in the history
  • Loading branch information
ales-erjavec committed May 20, 2022
1 parent ad56f9f commit df02626
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Orange/widgets/data/owfeatureconstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,11 +733,14 @@ def duplicateFeature(self):

@staticmethod
def check_attrs_values(attr, data):
for i in range(len(data)):
for var in attr:
if not math.isnan(data[i, var]) \
and int(data[i, var]) >= len(var.values):
return var.name
for var in attr:
col, _ = data.get_column_view(var)
mask = np.isnan(col)
mask = np.greater_equal(
col, len(var.values), out=mask, where=~mask
)
if mask.any():
return var.name
return None

def _validate_descriptors(self, desc):
Expand Down

0 comments on commit df02626

Please sign in to comment.