我是机器学习的初学者,可能有一些愚蠢的错误,我们将不胜感激。
我得到的错误,而下面的代码执行片段:
def plot_region(x_bounds, y_bounds):
slice = points[
(x_bounds[0] <= points.x) &
(points.x <= x_bounds[1]) &
(y_bounds[0] <= points.y) &
(points.y <= y_bounds[1])
]
ax = slice.plot.scatter("x", "y", s=35, figsize=(10, 8))
for i, point in slice.iterrows():
ax.text(point.x + 0.005, point.y + 0.005, point.word, fontsize=11)
plot_region(x_bounds=(4.0,4.2),y_bounds=(-0.5,-0.1))
plot_region(x_bounds=(0, 1), y_bounds=(4, 4.5))
ValueError:分散要求x列为数字
最佳答案
代码没什么问题......只是x_bounds =(4.0,4.2),y_bounds =(-0.5,-0.1)的点中没有值。
因此,切片是一个空的DataFrame。尝试打印。
关于python - Word2Vector ValueError:分散要求x列为数字,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47912045/