Python箱线图错误-';系列';对象没有属性';箱线图';

Python箱线图错误-';系列';对象没有属性';箱线图';,python,matplotlib,Python,Matplotlib,我试图创建一个boxplot,但遇到了这个错误-“Series”对象没有属性“boxplot” 这是我目前的代码: fig = plt.figure(figsize=(8,6)) ax = fig.gca() frame['ArrDelay'].boxplot(ax = ax) ax.set_title('BoxPlot of ArrDelay') ax.set_xlabel('ArrDelay') ax.set_ylabel('Delay Time') 有什么建议吗?假设您使用的是熊

我试图创建一个boxplot,但遇到了这个错误-“Series”对象没有属性“boxplot”

这是我目前的代码:

    fig = plt.figure(figsize=(8,6))
ax = fig.gca()
frame['ArrDelay'].boxplot(ax = ax)
ax.set_title('BoxPlot of ArrDelay')
ax.set_xlabel('ArrDelay')
ax.set_ylabel('Delay Time')

有什么建议吗?

假设您使用的是熊猫数据帧

fig = plt.figure(figsize=(8,6))
ax = fig.gca()
frame.boxplot(column='ArrDelay', ax=ax)
# frame['ArrDelay'].plot.box(ax=ax) # Alternative
ax.set_title('BoxPlot of ArrDelay')
ax.set_xlabel('ArrDelay')
ax.set_ylabel('Delay Time')

假设您使用的是数据帧

fig = plt.figure(figsize=(8,6))
ax = fig.gca()
frame.boxplot(column='ArrDelay', ax=ax)
# frame['ArrDelay'].plot.box(ax=ax) # Alternative
ax.set_title('BoxPlot of ArrDelay')
ax.set_xlabel('ArrDelay')
ax.set_ylabel('Delay Time')