elif isinstance(val, np.ndarray) and val.ndim > 1: raise ValueError("Per-column arrays must each be 1-dimensional") 当字典的值是一个numpy数组且像你的示例一样具有多个维度时,根据源代码会抛出错误。因此,使用列表非常有效,因为即使它是一个嵌套列表,列表也没有超过一个维度。
TheValueerror: per-column arrays must each be 1-dimensionalerror occurs when we attempt to perform an operation that requires one-dimensional arrays, but your input data is not properly formatted. How the Valueerror Reproduce? The following are the examples on how the valueerror occur: Example 1:...
ValueError: Per-column arrays must each be 1-dimensional,data=pd.DataFrame({'x':x,'y_pred':svm_pred.flatten(),'y_true':y_test.flatten()})#.iloc[100:200,:]data=pd.DataFrame({'x':x,'y_pred':svm_pred.fla