I cannot get the plot to provide results similar to the images. My results are not nearly as close to the actual average.
print(wnba[‘MIN’].value_counts(bins = 3, normalize = True))
for i in range(100):
low = wnba[wnba[‘MIN’] <= 347.333]
mid = wnba[(wnba[‘MIN’] > 347.333) & (wnba[‘Games Played’] <= 682.667)]
high = wnba[wnba[‘MIN’] > 682.667]
low_stratum = low.sample(4, random_state=i)
mid_stratum = mid.sample(4, random_state=i)
high_stratum = high.sample(4, random_state=i)
stratum = pd.concat([low_stratum, mid_stratum, high_stratum]) means.append(stratum['PTS'].mean())
Here is the code. Could someone explain what I am doing wrong or provide the right analysis to get the data with less sampling errors (like in the photo)?