Skip to content

Commit 037d11e

Browse files
committed
Update AnalyzeCSV.py
1 parent 3cfdf3e commit 037d11e

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

Project/AnalyzeCSV.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
#from uncertainties import ufloat
33
import numpy as np
44
import matplotlib.pyplot as plt
5+
from math import ceil
56

67

78
# Parameters
89
TheCsvInQuestion = "HillsboroughCoFL_DistToHurricaneShelters_x120_a250000m2_1764089128.077461.csv"
9-
percentile_specificity = 100
10+
percentile_spec = 100
1011
plt.figure(figsize=(15,10))
1112

1213

@@ -18,11 +19,20 @@
1819
#line_distance = ufloat(row["Distance"],row["uDist"])
1920
#print(line_distance)
2021

21-
percentiles_to_calc = np.linspace(0, 100, percentile_specificity+1)
22-
dist_percentiles = np.percentile(distances,percentiles_to_calc)
23-
plt.plot(np.array(percentiles_to_calc),np.array(dist_percentiles),label=TheCsvInQuestion)
22+
thepercentiles = np.linspace(0, 100, percentile_spec+1)
23+
thepercentiles_major = np.linspace(0, 100, 4+1)
24+
percent_data = np.percentile(distances,thepercentiles)
25+
percent_major_data = np.percentile(distances,thepercentiles_major)
26+
plt.plot(np.array(thepercentiles),np.array(percent_data),label=TheCsvInQuestion)
27+
plt.scatter(np.array(thepercentiles_major),np.array(percent_major_data),label="0th, 25th, 50th, 75th, and 100th percentiles")
2428
plt.title("Percentiles of the Distances from land locations throughout Hillsborough County, FL.")
2529
plt.xlabel("Percentile")
2630
plt.ylabel("Distance (miles)")
2731
plt.legend()
28-
plt.show()
32+
plt.show()
33+
34+
print("0th percentile:",percent_data[0])
35+
print("25th percentile:", percent_data[ceil(percentile_spec*0.25)])
36+
print("50th percentile:", percent_data[ceil(percentile_spec*0.50)])
37+
print("75th percentile:", percent_data[ceil(percentile_spec*0.75)])
38+
print("100th percentile:", percent_data[ceil(percentile_spec)])

0 commit comments

Comments
 (0)