import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
w_sum_sq = []
for i in range(1,30):
kmeans_pca = KMeans(n_clusters = i, init = "k-means++", random_state = 42)
kmeans_pca.fit(scores_pca)
w_sum_sq.append(kmeans_pca.inertia_)
plt.figure(figsize = (10,5))
plt.plot(range(1,30), w_sum_sq, marker = "o")
plt.title("Cluster using PCA Scores")
plt.ylabel("Within-Cluster Sum-of-Squares")
plt.xlabel("Number of clusters")
plt.show()
lectura del archivo
analisis univariado