按上述代码改完之后出现错误:E:\ana\envs\dl\python.exe E:\pythonProject\ADMM\wiene1.py Traceback (most recent call last): File "E:\p

动态 未结 0 93
小小草
小小草 LV1 2023年9月23日 23:40 发表
The error message indicates that the 'data' variable passed to the 'pearson_fusion' function is still a numpy array, even after converting it to a pandas dataframe. This could be because the 'data_array' variable passed to the 'minimize' function is still a numpy array. To fix this error, you need to pass the converted pandas dataframe to the 'minimize' function instead of the original numpy array. You can modify the code as follows: ```python import pandas as pd # Convert data_array to a pandas dataframe data = pd.DataFrame(data_array) # Pass the pandas dataframe to the minimize function res = minimize(objective_function, [0.1]*6 + [1000], args=(data,), method='Nelder-Mead') ``` This should ensure that the 'data' variable passed to the 'pearson_fusion' function is a pandas dataframe and the 'corrwith' method can be called on it without errors.
收藏(0)  分享
相关标签: 智能问答
问题没解决?让AI助手帮你作答 AI助手
0个回复
  • 消灭零回复