[Data Science] Clustering Wines Project - Pandas Pandas Pandas
Hi guys, I failed in test case 3 while passing the others. Don't know where did I go wrong.. can any master help me? Thank you very much :D import numpy as np n = int(input()) X = [] for i in range(n): X.append([float(x) for x in input().split()]) point_1 = np.array((0.,0.)) point_2 = np.array((2.,2.)) cluster_0 = [] cluster_1 = [] for i in X: if np.linalg.norm(np.array(tuple(i)) - point_1) <= np.linalg.norm(np.array(tuple(i)) - point_2): cluster_0.append(np.array(i)) else: cluster_1.append(np.array(i)) mean_1 = np.mean(cluster_0[:], axis = 0) mean_2 = np.mean(cluster_1[:], axis = 0) if np.array(cluster_0).size == 0: print(None) else: print(np.round(mean_1, 2)) if np.array(cluster_1).size == 0: print(None) else: print(np.round(mean_2, 2))