diff --git a/sklearn/cluster/_agglomerative.py b/sklearn/cluster/_agglomerative.py index d8cf1002dfcfe..55215d2a0312c 100644 --- a/sklearn/cluster/_agglomerative.py +++ b/sklearn/cluster/_agglomerative.py @@ -755,8 +755,7 @@ def _hc_cut(n_clusters, children, n_leaves): if n_clusters > n_leaves: raise ValueError( "Cannot extract more clusters than samples: " - "%s clusters where given for a tree with %s leaves." - % (n_clusters, n_leaves) + f"{n_clusters} clusters were given for a tree with {n_leaves} leaves." ) # In this function, we store nodes as a heap to avoid recomputing # the max of the nodes: the first element is always the smallest