Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f7f23f4

Browse files
committedMar 5, 2025··
Better error if scipy is not installed
1 parent 8edc47a commit f7f23f4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎holoviews/operation/element.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,10 @@ class dendrogram(Operation):
12301230
main_element = param.ClassSelector(default=HeatMap, class_=Dataset, instantiate=False, is_instance=False)
12311231

12321232
def _compute_linkage(self, dataset, dim, vdim):
1233-
from scipy.cluster.hierarchy import dendrogram, linkage # TODO: Add scipy check
1233+
try:
1234+
from scipy.cluster.hierarchy import dendrogram, linkage
1235+
except ImportError:
1236+
raise ImportError("scipy is needed for the dendrogram operation") from None
12341237

12351238
arrays, labels = [], []
12361239
for k, v in dataset.groupby(dim, container_type=list, group_type=Dataset):

0 commit comments

Comments
 (0)
Please sign in to comment.