Learn practical skills, build real-world projects, and advance your career

Clustering Categorical Data

You are given much more country data. Using the same methodology as the one in the lecture, group all the countries in 2 clusters.

Already done that? Okay!

There are other features: name and continent.

Encode the continent one and use it in the clustering solution. Think about the difference with the previous exercise.

Import the relevant libraries

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
from sklearn.cluster import KMeans  

Load the data