Learn practical skills, build real-world projects, and advance your career
Created 3 years ago
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Scale
from sklearn.preprocessing import StandardScaler
# KMeans Clustering
from sklearn.cluster import KMeans
# Hierarchial Clustering
from scipy.cluster.hierarchy import linkage
from scipy.cluster.hierarchy import dendrogram
from scipy.cluster.hierarchy import cut_tree
df = sns.load_dataset('iris')
df.head()
df.sample(5)
df['species'].value_counts()
setosa 50
versicolor 50
virginica 50
Name: species, dtype: int64
df.shape
(150, 5)