Correct Coding Would Not Plot Histogram

Screen Link:
https://app.dataquest.io/m/305/the-mean/9/estimates-from-low-sized-samples

My Code:
means =

for i in range(10000):
sample = houses[‘SalePrice’].sample(100, random_state=i)
means.append(sample.mean())

plt.hist(means)
plt.axvline(houses[‘SalePrice’].mean())
plt.xlabel(‘Sample mean’)
plt.ylabel(‘Frequency’)
plt.xlim(0,500000)

Replace this line with your code

What I expected to happen:
I expected a Histogram to plot.

What actually happened:
No histogram plotted.

Replace this line with the output/error

I generated my own code first with no histogram plotting. Then I copied the answer coding and pasted that in the code entry area. Even with the Dataquest answer, Histogram would not plot.

1 Like

Hi Bruce,

Try to add plt.show() at the end of your code and re-run it again.

Thanks Elena.
I did do that at the time and it didn’t help.
After a while, I thought I may have executed some coding that sort of gave the Dataquest system problems. So, I figured if I exited from Dataquest training and then got back in, it might execute with a plot.
It did so without the plt.show() statement.