ValueError是什么意思?

Ant*_*nti 0 python

我,我试图计算一组点和一个线段之间的最短距离.一切顺利,直到使用来自两组数组的值计算距离,一组用于x距离,一组用于y距离.

计算距离的线是:

d = np.sqrt( dx**2 + dy**2 ).
Run Code Online (Sandbox Code Playgroud)

它告诉我::

ValueError: operands could not be broadcast together with shapes (3312,) (0,) 
Run Code Online (Sandbox Code Playgroud)

我之前使用过该脚本的另一组值,它完美无缺.但现在它已不复存在了.我试着找到错误信息的含义但到目前为止还没有成功.有人可以帮忙吗?

Hac*_*lic 5

ValueError当内置操作或函数接收到具有正确类型但值不合适的参数时引发

演示:

>>> int("1")
1
>>> int("h")         # valueError
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: 'h'
Run Code Online (Sandbox Code Playgroud)