Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/279.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在python中绘制预期值与实际值的关系图?_Python_Pandas_Dataframe_Charts - Fatal编程技术网

如何在python中绘制预期值与实际值的关系图?

如何在python中绘制预期值与实际值的关系图?,python,pandas,dataframe,charts,Python,Pandas,Dataframe,Charts,当前数据帧 Original Predicted 0 1059 810.37 1 1441 527.76 2 977 366.07 ... 744 2000 1878.18 期望图 我尝试过的代码: plt.plot(arr, sub_df['original'], 'b-', label = 'actual') plt.

当前数据帧

          Original      Predicted
0           1059         810.37
1           1441         527.76
2           977          366.07
...
744         2000         1878.18
期望图

我尝试过的代码:

plt.plot(arr, sub_df['original'], 'b-', label = 'actual')
plt.plot(arr, sub_df['predicted'], 'ro', label = 'prediction')
plt.xticks(rotation = '60'); 
plt.legend()
电流输出:


假设df是您的数据帧:

import matplotlib.pyplot as plt
plt.plot(df.Original)
plt.plot(df.Predicted, 'o')

plt.show()

我觉得不错。实际情况就在那里,在预测的后面。您可以交换两个
plt.plot
的顺序,您将看到它。然而,图表显示您的模型运行得不太好。