我正在尝试制作一个简单的箱线图,来展示包含在两个数据框df1和df2中的变量'x'。为此,我使用了以下代码:
fig, axs = plt.subplots()
axs[0, 0].boxplot([df1['x'], df2['x']])
plt.show();
不过,我得到了这个:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-108-ce962754d553> in <module>()
----> 2 axs[0, 0].boxplot([df1['x'], df2['x']])
3 plt.show();
4
TypeError: 'AxesSubplot' object is not subscriptable
有什么想法吗?