2024-04-23 23:06:38 发布
网友
我有两个不同的数据帧格式如下。在
dfclean Out[1]: obj 0 682 1 101 2 33 dfmalicious Out[2]: obj 0 17 1 43 2 8 3 9 4 211
我的用例是绘制一个散点图,清楚地显示来自两个数据帧的obj值。为此,我使用python。我用了几个例子来复制我的数据,但我用了两个数据框。非常感谢任何帮助。在
obj
How to plot two DataFrame on same graph for comparison
要在单个轴上绘制多个列组,请重复指定目标plot方法ax
plot
ax
选项1]
In [2391]: ax = dfclean.reset_index().plot(kind='scatter', x='index', y='obj', color='Red', label='G1') In [2392]: dfmalicious.reset_index().plot(kind='scatter', x='index', y='obj', color='Blue', label='G2', ax=ax) Out[2392]: <matplotlib.axes._subplots.AxesSubplot at 0x2284e7b8>
选项2]
要在单个轴上绘制多个列组,请重复指定目标
plot
方法ax
选项1]
选项2]
^{pr2}$相关问题 更多 >
编程相关推荐