Skip to content
Snippets Groups Projects
Commit 0a6d4fe7 authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

fixed a bug in the heatmap code

parent e370b0f3
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -33,7 +33,7 @@ class HeatmapTask(AnalyticTask):
df = reduce(lambda a, b: a.append(b), numerical_arrays)
if not subsets:
# empty subsets equals all samples in one subset
subsets = df['id'].unique()
subsets = [df['id'].unique().tolist()]
else:
# if subsets are defined we drop the rows that are not part of one
flattened_subsets = [x for subset in subsets for x in subset]
......
......@@ -61,3 +61,25 @@ class TestHeatmap:
id_filter=[],
subsets=subsets)
assert 'specified subsets does not match' in e
def test_empty_subset_equals_full_subset(self):
numerical_arrays = [
pd.DataFrame([[101, 'foo', 5], [101, 'bar', 6], [102, 'foo', 10],
[102, 'bar', 11], [103, 'foo', 15], [103, 'bar', 16],
[104, 'foo', 20], [104, 'bar', 21]],
columns=['id', 'feature', 'value'])
]
result_1 = self.task.main(numerical_arrays=numerical_arrays,
numericals=[],
categoricals=[],
ranking_method='mean',
id_filter=[],
subsets=[])
result_2 = self.task.main(numerical_arrays=numerical_arrays,
numericals=[],
categoricals=[],
ranking_method='mean',
id_filter=[],
subsets=[[101, 102, 103, 104]])
assert result_1 == result_2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment