def plot_pca_scatter3D(pca_values, x, y):
for name, label in [('1', 0), ('2', 1), ('3', 2), ('4', 3)]:
    ax.text3D(pca_values[y == label, 0].mean(),
              pca_values[y == label, 1].mean() + 1.5,
              pca_values[y == label, 2].mean(), name,
              horizontalalignment='center',
              bbox=dict(alpha=.5, edgecolor='w', facecolor='w'))
# Reorder the labels to have colors matching the cluster results
y = np.choose(y, [1, 2, 0]).astype(np.float)
ax.scatter(pca_values[:, 0], pca_values[:, 1], pca_values[:, 2], c=y, cmap=plt.cm.spectral,
           edgecolor='k')

ax.w_xaxis.set_ticklabels([])
ax.w_yaxis.set_ticklabels([])
ax.w_zaxis.set_ticklabels([])

plt.show()

这是我的情节分散功能 . 但是当我尝试执行它时 .

from sklearn.decomposition import PCA
pca = PCA(n_components=300)
X_pca = pca.fit_transform(X)
plot_pca_scatter3D(X_pca, X, Y)

我收到此错误消息 Cannot cast array data from dtype('float64') to dtype('int64') according to the rule 'safe'

我的数据类型:
X_pca(浮动64)尺寸(944,300)
Y(pandas.core.series模块的系列对象)大小(944,)
X(dataFrame)大小(944,600)

该怎么办 ?