Hi guys,
I have an issue guys and I am not sure how to fix it, was wondering if anyone got the same issue before:
For the tests, I pass all expect for three, below you can find the errors I got:
Matplotlib created a temporary config/cache directory at /tmp/matplotlib-_850actj because the default path (/config/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
EEE…
ERROR: test_bar_plot_labels (test_module.BarPlotTestCase)
Traceback (most recent call last):
File “/home/runner/boilerplate-page-view-time-series-visualizer-2/test_module.py”, line 38, in setUp
self.ax = self.fig.axes[0]
AttributeError: ‘NoneType’ object has no attribute ‘axes’
======================================================================
ERROR: test_bar_plot_legend_labels (test_module.BarPlotTestCase)
Traceback (most recent call last):
File “/home/runner/boilerplate-page-view-time-series-visualizer-2/test_module.py”, line 38, in setUp
self.ax = self.fig.axes[0]
AttributeError: ‘NoneType’ object has no attribute ‘axes’
======================================================================
ERROR: test_bar_plot_number_of_bars (test_module.BarPlotTestCase)
Traceback (most recent call last):
File “/home/runner/boilerplate-page-view-time-series-visualizer-2/test_module.py”, line 38, in setUp
self.ax = self.fig.axes[0]
AttributeError: ‘NoneType’ object has no attribute ‘axes’
Ran 11 tests in 17.074s
FAILED (errors=3)
==========
Any idea guys how to fix this?
this is my code for the bar plot func:
def draw_bar_plot():
dfbar = df.copy()
dfbar[‘month’] = dfbar.index.month
dfbar[‘year’] = dfbar.index.year
df_bar = dfbar.groupby([‘year’, ‘month’])[‘value’].mean()
df_bar = df_bar.unstack()
fig = df_bar.plot.bar(legend=True, figsize=(20, 12), ylabel='Average Page Views', xlabel = 'Years', fontsize=10).figure
plt.legend(['January', 'February', 'March', 'April' , 'May' , 'June', 'July', 'August', 'September', 'October', 'November', 'December'], title='Months', fontsize=10)
plt.xticks(fontsize=20)
plt.yticks(fontsize=20)
# Save image and return fig (don't change this part)
fig.savefig('bar_plot.png')
return
Thank you in advance guys