我有下面两个我写的代码和excel文件。我只是不明白如何将它们组合起来,这样我就可以从excel文件中读取并使用这些数字组成一个簇。在import matplotlib.pyplot as plt
import xlrd
from matplotlib import style
style.use("ggplot")
from sklearn.cluster import KMeans
fileWorkspace = 'C://Users/bob/Desktop/'
pull=[]
wb1 = xlrd.open_workbook(fileWorkspace + 'try.xlsx')
sh1 = wb1.sheet_by_index(0)
for a in range(0,sh1.nrows):
for b in range(0,sh1.ncols):
pull.append(sh1.cell(a,b).value)
print('Finished in row' + str(a))
x = [11,19,23,33,44,91,92,90,60,63]
y = [92,85,22,25,86,78,63,51,66,15]
X = [list(item) for item in zip(x,y)]
kmeans = KMeans(n_clusters=3)
kmeans.fit(X)
centroids = kmeans.cluster_centers_
labels = kmeans.labels_
print(centroids)
prin