@justinholman/

SellingPriceBootstrapConfidenceIntervals

Python

No description

fork
loading
Files
  • main.py
  • hist1.png
  • PuebloRESalesSample.csv

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.946065210231384","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IG1hdHBsb3RsaWIgYXMgbXBsCiMgdGhpcyB1c2UoJ0FnZycpIHBhcnQgaXMgd2hhdCBhbGxvd3MgdXMgdG8gY3JlYXRlIGdyYXBoaWNzIAptcGwudXNlKCdBZ2cnKQoKaW1wb3J0IG51bXB5IGFzIG5wCmltcG9ydCBwYW5kYXMgYXMgcGQKaW1wb3J0IG1hdHBsb3RsaWIucHlwbG90IGFzIHBsdAppbXBvcnQgc2VhYm9ybiBhcyBzbnMKCnJlID0gcGQucmVhZF9jc3YoJ1B1ZWJsb1JFU2FsZXNTYW1wbGUuY3N2JykKCnNwID0gW10KCmZvciBpIGluIHJhbmdlKDEwMDApIDoKICBzYW1wbGVyZSA9IG5wLnJhbmRvbS5jaG9pY2UocmVbJ1NlbGxpbmcgUHJpY2UnXSwxMDApCiAgbWVhbl9zZWxscHJpY2UgPSBucC5tZWFuKHNhbXBsZXJlKQogIHNwLmFwcGVuZChtZWFuX3NlbGxwcmljZSkKICAjcHJpbnQobWVhbl9zZWxscHJpY2UpCiAgaSA9IGkgKyAxCgpjb25mX2ludCA9IG5wLnBlcmNlbnRpbGUoc3AsIFsyLjUsOTcuNV0pCnByaW50KCI5NSUgY29uZmlkZW5jZSBpbnRlcnZhbDogIiArIHN0cihjb25mX2ludCkpCiNwcmludChjb25mX2ludCkKCnNucy5kaXN0cGxvdChzcCkKcGx0LnhsYWJlbCgnTWVhbiBTZWxsaW5nIFByaWNlJykKcGx0LnlsYWJlbCgnRnJlcXVlbmN5JykKcGx0LnNob3coKQpwbHQuc2F2ZWZpZygnaGlzdDEucG5nJykKcGx0LmNsZigpCg=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import matplotlib as mpl
# this use('Agg') part is what allows us to create graphics 
mpl.use('Agg')

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

re = pd.read_csv('PuebloRESalesSample.csv')

sp = []

for i in range(1000) :
  samplere = np.random.choice(re['Selling Price'],100)
  mean_sellprice = np.mean(samplere)
  sp.append(mean_sellprice)
  #print(mean_sellprice)
  i = i + 1

conf_int = np.percentile(sp, [2.5,97.5])
print("95% confidence interval: " + str(conf_int))
#print(conf_int)

sns.distplot(sp)
plt.xlabel('Mean Selling Price')
plt.ylabel('Frequency')
plt.show()
plt.savefig('hist1.png')
plt.clf()