Screen Link:
https://app.dataquest.io/m/305/the-mean/8/estimating-the-population-mean
My Code:
mean_population = houses['SalePrice'].mean()
size = 5
for r in range(101):
sample_price = houses['SalePrice'].sample(size, random_state=r)
mean_sample = sample_price.mean()
sampling_error = mean_population - mean_sample
import matplotlib.pyplot as plt
plt.scatter(len(sample_price), sampling_error)
plt.axhline(0)
plt.axvline(2930)
plt.xlabel('Sample size')
plt.ylabel('Sampling error')
size += 29
What I expected to happen:
I am able to generate the scatter plot using my code and it looks quite similar to the expected result when compared
What actually happened:
As per DQ, my plot is not matching the expected result.
Paste output/error here
One difference I noticed between the code by DQ and mine is that, DQ is plotting outside the for loop.
But still I am not able to make out the real issue. Please provide your feedback.