Traceback (most recent call last): File "D:\tokamaka\实验集\Python\SVM低数据兼测试版本\DisruptionPredictor\svm.py", line 77, in <module> df_train = pd.DataFrame({'X_train': X_train, 'y_train': y_train}) File "D:\python\lib\site-packages\pandas\core\frame.py", line 664, in __init__ mgr = dict_to_mgr(data, index, columns, dtype=dtype, copy=copy, typ=manager) File "D:\python\lib\site-packages\pandas\core\internals\construction.py", line 493, in dict_to_mgr return arrays_to_mgr(arrays, columns, index, dtype=dtype, typ=typ, consolidate=copy) File "D:\python\lib\site-packages\pandas\core\internals\construction.py", line 118, in arrays_to_mgr index = _extract_index(arrays) File "D:\python\lib\site-packages\pandas\core\internals\construction.py", line 653, in _extract_index raise ValueError("Per-column arrays must each be 1-dimensional") ValueError: Per-column arrays must each be 1-dimensional 进程已结束,退出代码1
时间: 2023-07-21 18:56:06 浏览: 107
这是一个 Python 报错信息,其中最后一行显示了错误信息:Per-column arrays must each be 1-dimensional。这个错误通常发生在尝试将多维数组传递给 pandas.DataFrame() 函数的参数时。这个函数要求每个参数都是一维数组。你需要检查你的代码中哪个参数传递了多维数组,然后将其转换为一维数组即可。
相关问题
D:\python\python.exe D:\tokamaka\实验集\Python\SVM低数据兼测试版本\DisruptionPredictor\Test3.py Traceback (most recent call last): File "D:\tokamaka\实验集\Python\SVM低数据兼测试版本\DisruptionPredictor\Test3.py", line 59, in <module> data, labels = load_data_parallel('train', shot, directory) File "D:\tokamaka\实验集\Python\SVM低数据兼测试版本\DisruptionPredictor\Test3.py", line 39, in load_data_parallel for st in shots: TypeError: 'int' object is not iterable
根据你给出的信息,这个错误的原因是在 `load_data_parallel` 函数中,`shots` 参数是一个整数,而不是一个可迭代对象。因此,程序无法在 `for` 循环中处理它。你需要检查一下 `shots` 参数的类型和值是否正确,并确保它是一个可迭代对象(如列表、元组等)。你也可以在代码中加入一些调试语句,以便更好地定位问题所在。
Traceback (most recent call last): File "D:\tokamaka\实验集\Python\SVM低数据兼测试版本\DisruptionPredictor\Test3.py", line 57, in <module> X_train, y_train = load_data(train_folder) File "D:\tokamaka\实验集\Python\SVM低数据兼测试版本\DisruptionPredictor\Test3.py", line 31, in load_data return np.array(X), np.array(y) ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (120, 7) + inhomogeneous part.
这个错误提示意味着在你的代码中,尝试将一个序列赋值给了一个数组元素。在请求的数组维度中,存在不同的形状,导致无法进行赋值操作。在你的代码中,这个错误发生在第31行,load_data函数中。你需要检查load_data函数的代码,以找到导致该错误的原因。可能的原因包括数据类型不匹配,数据维度不匹配等等。