On jupyter lab I get what looks like the correct outcomes.
When I run it on repl it shows the following:
.F…Killed
exit status 137
So I fail the second test and then after a couple of tests the program is killed presumably by lack of space on the container ( please correct me if I am wrong).
if I run the exact same program again it returns:
.F.Killed
exit status 137
Any help with this would be appreciated.
here is my code:
# Import data (Make sure to parse dates. Consider setting index column to 'date'.)
df = pd.read_csv('fcc-forum-pageviews.csv',
index_col = 'date', parse_dates = ['date'])
# Clean data
df = df[(df['value'] < df['value'].quantile(0.975)) & (df['value'] > df['value'].quantile(0.025))]
def draw_line_plot():
fig = plt.figure()
fig, ax = plt.subplots(figsize=(20, 10))
plt.plot(df, color = 'r')
plt.title('Daily freeCodeCamp Forum Page Views 5/2016-12/2019')
plt.xlabel('Date')
plt.ylabel('Page Views')
# 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 = df.copy().reset_index()
df_bar['year'] = df_bar['date'].dt.year
df_bar['month'] = df_bar['date'].dt.month_name()
df_bar_group = df_bar.groupby(['year','month'])['value'].mean().reset_index()
# Draw bar plot
fig, ax = plt.subplots(1, figsize=(20, 10))
sns.barplot(data=df_bar_group, x='year', y='value', hue='month')
plt.xlabel('Years')
plt.ylabel('Average Page Views')
plt.legend(loc=2, title='Months')
# 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)
fig, ax = plt.subplots(1,2, figsize = (20,10))
sns.boxplot(data = df_box, x = 'year', y = 'value', ax = ax[0])
ax[0].set_title('Year-wise Box Plot (Trend)')
ax[0].set_xlabel('Year')
ax[0].set_ylabel('Page Views')
sns.boxplot(data = df_box, x = 'month', y = 'value', order =['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] , ax = ax[1])
ax[1].set_title('Month-wise Box Plot (Seasonality)')
ax[1].set_xlabel('Month')
ax[1].set_ylabel('Page Views')