text_plain_output_1.png
from scipy.spatial.distance import squareform, pdist

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

wine_data = pd.read_csv('../input/uci-wine-data/wine-clustering.csv')

def normalize_data(data):
    data_normalized = data.copy()
    for col in data.columns:
        data_normalized[col] = (data_normalized[col] - data_normalized[col].min()) / (data_normalized[col].max() - data_normalized[col].min())
    return data_normalized
wine_data_normalized = normalize_data(wine_data)

def get_dissimilarity(data):
    from scipy.spatial.distance import squareform, pdist
    similarity_matrix = pd.DataFrame(squareform(pdist(data, 'euclidean')))
    return similarity_matrix
similarity_matrix = get_dissimilarity(wine_data_normalized)
similarity_matrix