Hierarchical Clustering of Countries Based on Eurovision Votes

Hierarchical Clustering of Countries Based on Eurovision Votes

Hierarchical Clustering of Countries Based on Eurovision Votes. A walk-through example of how you can apply hierarchical clustering on Eurovision Votes

Description

This dataset contains the votes From Country to To Country for Eurovision 2016. There are the Jury Votes and the Televote. We would like to see how people voted in Eurovision 2016 and for that reason, we will consider only the Televote. Our ultimate goal is to create a dendrogram that will show the relationship between countries. The algorithm will be the Hierarchical Clustering.

Data Processing

We will load the data and we will keep only three columns such as the From CountryTo Country and the Televote Rank. Then we will reshape the data where the rows will be the From Country ,the columns will the To Country and the values will be the Televote Rank. Notice that each country cannot vote itself and for that reason will be NA values. We will impute the NAs with the Televote Rank=1 assuming that each country would have given the highest score to itself if that was allowed. Bear in mind that we want to cluster the countries based on their vote preferences.

from scipy.cluster.hierarchy import linkage, dendrogram
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.cluster.vq import whiten
%matplotlib inline
eurovision = pd.read_csv("eurovision-2016.csv")
televote_Rank = eurovision.pivot(index='From country', columns='To country', values='Televote Rank')
## fill NAs with 1
televote_Rank.fillna(1, inplace=True)

data-science clustering unsupervised-learning python

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Data Science With Python Training | Python Data Science Course | Intellipaat

šŸ”µ Intellipaat Data Science with Python course: https://intellipaat.com/python-for-data-science-training/In this Data Science With Python Training video, you...

Python for Data Science | Data Science With Python | Python Data Science Tutorial

šŸ”„Intellipaat Python for Data Science Course: https://intellipaat.com/python-for-data-science-training/In this python for data science video you will learn e...

Applied Data Science with Python Certification Training Course -IgmGuru

Master Applied Data Science with Python and get noticed by the top Hiring Companies with IgmGuru's Data Science with Python Certification Program. Enroll Now

Data Science Projects | Data Science | Machine Learning | Python

Practice your skills in Data Science with Python, by learning and then trying all these hands-on, interactive projects, that I have posted for you.

Data Science Projects | Data Science | Machine Learning | Python

Practice your skills in Data Science with Python, by learning and then trying all these hands-on, interactive projects, that I have posted for you.