'Why is the dendrogram not being made with single linkage?

I am trying to generate a dendrogram for a single-link for a dataset. Here is the code I am trying to use:

x = pd.read_csv(".\Homework 5\dataset_hwk5\X.csv")
agg = AgglomerativeClustering(linkage="single")
assign = agg.fit_predict(x)
link_array = linkage(x,method='single')
dendrogram(link_array)
ax = plt.gca()
plt.xlabel("Sample index")
plt.ylabel("Cluster distance")
plt.show()

When I set the method to complete or ward it will work as intended. When the method is set to single the program will stop at dendrogram(link_array) without giving any reasons why.

Any help is appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source