# 5. Simple Random Sampling

https://app.dataquest.io/m/283/sampling/5/simple-random-sampling

My question:
I dont get why the plt.scatter has a range for the x value between 1 and 101. Why isnt it 0,100 ?

My Code:

``````import pandas as pd
import matplotlib.pyplot as plt

parameter = wnba['PTS'].mean()

meanlist = []
for i in range(100):
sample1 = wnba["PTS"].sample(10, random_state = i)
meanlist.append(sample1.mean())

plt.scatter(range(1,101),meanlist)
plt.axhline(parameter)`````````

Hi. The x values in this case are not very relevant. They are simply used to count the number of iterations of your “for loop”. It doesn’t make much sense to use 0,100 because:

1. The x values are meant to connect each iteration to one unique mean value on the y axis. If you start from 0 then it means that the first mean value is associated with the 0th iteration, the 2nd mean value is associated with the 1st iteration etc. This is not a problem but it may be confusing. So why not just start counting from 1 so that the 1st iteration is associated with the first mean value and the 100th iteration with the 100th mean value?

Good luck

1 Like