Time_series_visualiser

My code is running properly in google colab but throwing the error below in replit

File “main.py”, line 6, in

time_series_visualizer.draw_line_plot()

File “/home/runner/boilerplate-page-view-time-series-visualizer-1/time_series_visualizer.py”, line 24, in draw_line_plot
fig.savefig(‘line_plot.png’)
AttributeError: ‘AxesSubplot’ object has no attribute ‘savefig’ ##

import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()

Import data (Make sure to parse dates. Consider setting index column to ‘date’.)

df = None

Clean data

df = None

def draw_line_plot():
# Draw line plot

# Save image and return fig (don't change this part)
fig.savefig('line_plot.png')
return fig

def draw_bar_plot():
# Copy and modify data for monthly bar plot
df_bar = None

# Draw bar plot





# Save image and return fig (don't change this part)
fig.savefig('bar_plot.png')
return fig

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]

# Draw box plots (using Seaborn)





# Save image and return fig (don't change this part)
fig.savefig('box_plot.png')
return fig

Link to the challenge:

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