Page View Time Series Visualizer trouble with replit?

hi! I have a trouble with this exercise.

My replit: https://replit.com/@ManuelLonigro/boilerplate-page-view-time-series-visualizer#time_series_visualizer.py

I found many ways to draw the boxplot, many tutorials, but always have a new error . In colab this works fine, but here not and I don’t know why. May be it’s a version problem? Please help me. Thanks!

Work backwards from the error:

Traceback (most recent call last):
  File "main.py", line 8, in <module>
    time_series_visualizer.draw_box_plot()
  File "/home/runner/4Rnic7ia3Dj/time_series_visualizer.py", line 59, in draw_box_plot
    axes[0] = axes[0].set_title("Year-wise Box Plot (Trend)") 
AttributeError: 'tuple' object has no attribute 'set_title'

set_title() is a method of Axes, but python thinks axes[0] is a tuple. Why? Look back where it was assigned before the error:

     axes[0] = sns.boxplot(x=df_box['year'],y=df_box['value'],ax=axes[0]), axes[0].set_ylim(ymax=200000)

which is your boxplot call and a method call on axes[0] joined with a comma, or a tuple. Print it and you’ll see

(<AxesSubplot:xlabel='year', ylabel='value'>, (10083.599999999999, 200000.0))

it’s definitely a tuple. Fix that and a few more and it passes.

1 Like

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