Traceback (most recent call last): File "<input>", line 1, in <module> File "F:\软件\PyCharm 2021 64bit\PyCharm 2021.1.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "F:\软件\PyCharm 2021 64bit\PyCharm 2021.1.1\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "C:/Users/LENOVO/PycharmProjects/pythonProject3/venv/BP1.py", line 13, in <module> data_predict_input=np.array([12.26],[12.55]) TypeError: Field elements must be 2- or 3-tuples, got '12.55'
时间: 2023-08-28 07:06:46 浏览: 140
Mac下anaconda中Spyder打开报错Traceback(most recent call last)…问题
5星 · 资源好评率100%
这个错误提示是因为你在创建一个 numpy 数组时,传入了错误的参数。numpy 数组的正确创建方式是:`np.array([value1, value2, ...])`,其中 `value1, value2` 等是数组元素的值,需要用逗号隔开。你的错误在于只传入了一个值 `12.26` 和 `12.55`,应该改为 `np.array([12.26, 12.55])`。这样就可以创建一个含有两个元素的 numpy 数组了。
阅读全文