I am trying to analyze data to determine the outcome based on a dendrogram. The problem is that I have primarily 2 groups of data "H" and "U", both of which are analyzed together. At the end of the dendrogram, I need to know which area has more "H" and "U". I tried using the dictionary information of the dendrogram, but when I opened the functions I noticed that at no point does it contain the information I put in through linkage. The following is the code I'm using: import numpy as np import matplotlib.pyplot as plt from scipy.cluster.hierarchy import dendrogram, linkage, set_link_color_palette from scipy.cluster import hierarchy import pandas as pd from sklearn.decomposition import PCA df=pd.read_csv(name+".csv", index_col=None, header=0) normalized_df=(df-df.mean())/df.std() pca=PCA(n_components=6, n_oversamples=6) principalComponents = pca.fit_transform(df) principalDF = pd.DataFrame(data = principalComponents, columns = ['principal component 1', 'principal component 2', 'principal component 3', 'principal component 4', 'principal component 5', 'principal component 6']) #Adds the type (U/H) to the dataframe finalDF = pd.concat([principalDF, full_df[['type']]], axis = 1) #From here on is when I start to have problems data = list(zip(finalDF['principal component 1'], finalDF['principal component 2'])) linkage_data = linkage(data, method='ward', metric='euclidean') hierarchy.set_link_color_palette(['r','g','b','w']) den=dendrogram(linkage_data) plt.title("Attempt #1") plt.show() The dendrogram looks as expected. The problem is that I am unable to differentiate the type (H or U) of each point. As mentioned, I attempted to look at the properties of the dendrogram, such as icoord and dcoord, but I couldn't figure out what it meant. The data itself I'm using is 6 different columns, with different numbers which is the data I normalize ((df-df.mean())/df.std), and then take the principal components. Any advice? Continue reading...