Learn practical skills, build real-world projects, and advance your career
Created 3 years ago
import warnings
warnings.filterwarnings('ignore')
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
# To Scale our data
from sklearn.preprocessing import scale
# To perform KMeans clustering
from sklearn.cluster import KMeans
# To perform Hierarchical 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.shape
(150, 5)
df['species'].value_counts()
virginica 50
setosa 50
versicolor 50
Name: species, dtype: int64