if unused_columns:
indexes = [i for i, n in enumerate(metric_labels) if n in unused_columns]
// Delete unused columns
matrix = np.delete(matrix, indexes, 1)
for i in sorted(indexes, reverse=True):
del metric_labels[i]
return matrix, metric_labels
After Change
LOG.debug("clean_metric_data added %d metrics and removed %d metric.", len(missing_columns),
len(unused_columns))
default_val = 0
metric_cat_size = len(metric_cat)
matrix = np.ones((len(metric_matrix), metric_cat_size)) * default_val
metric_labels_dict = {n: i for i, n in enumerate(metric_labels)}
// column labels in matrix has the same order as ones in metric catalog
// missing values are filled with default_val
for i, metric_name in enumerate(metric_cat):