Page View Time Series Visualizer - Box Plot Issues

Having trouble with the box plot problem from the page view time series project. Any help is appreciated, and my code is below:

def draw_box_plot():
    # Prepare data for box plots (this part is done!)
    df_box = df.copy()
    df_box.reset_index(inplace=True)
    df_box['year'] = [d.year for d in df_box.date]
    df_box['month'] = [d.strftime('%b') for d in df_box.date]

    # TODO: Y-axis Labels should be 0,20000, 200000
    # Draw box plots (using Seaborn)
    ylimits = (0,200000)
    # yticks = [yt for yt in range(ylimits[0], ylimits[-1], 20000)]
    fig, axes = plt.subplots(1, 2, figsize=(20, 10), sharex=False, sharey=False)
    
    sns.boxplot(x=df_box['year'], y=df_box['value'], ax=axes[0]).set(xlabel="Year", ylabel="Page Views", title="Year-wise Box Plot (Trend)", ylim=ylimits)
    
    sns.boxplot(x=df_box['month'], y=df_box['value'], order=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
                ax=axes[1]).set(xlabel="Month", ylabel="Page Views", title="Month-wise Box Plot (Seasonality)", ylim=ylimits)
    
    # Save image and return fig (don't change this part)
    fig.savefig('box_plot.png')
    return fig

Your order name not define

order=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.