Spaces:
Sleeping
Sleeping
nastasiasnk
commited on
Commit
•
e688670
1
Parent(s):
98e3569
Update app.py
Browse files
app.py
CHANGED
@@ -249,9 +249,10 @@ def test(input_json):
|
|
249 |
|
250 |
|
251 |
subdomainsAccessibility = computeAccessibility(df_matrix,LivabilitySubdomainsInputs,alpha,threshold)
|
252 |
-
|
|
|
253 |
|
254 |
-
AccessibilityInputs = pd.concat([subdomainsAccessibility,
|
255 |
|
256 |
|
257 |
|
@@ -264,9 +265,9 @@ def test(input_json):
|
|
264 |
|
265 |
|
266 |
|
267 |
-
def accessibilityToLivability (DistanceMatrix,
|
268 |
|
269 |
-
livability = pd.DataFrame(index=DistanceMatrix.index, columns=
|
270 |
|
271 |
for domain in UniqueDomainsList:
|
272 |
livability[domain] = 0
|
@@ -281,20 +282,20 @@ def test(input_json):
|
|
281 |
max_livability = float(SubdomainAttributeDict[key]['max_points'])
|
282 |
domains = [str(item) for item in SubdomainAttributeDict[key]['domain']]
|
283 |
|
284 |
-
if key in
|
285 |
-
livability_score = remap(
|
286 |
-
livability.loc[
|
287 |
-
livability.loc[
|
288 |
if any(domains):
|
289 |
for domain in domains:
|
290 |
if domain != 'Workplaces':
|
291 |
-
livability.loc[
|
292 |
-
livability.loc[
|
293 |
|
294 |
elif key == 'commercial':
|
295 |
-
livability_score = remap(
|
296 |
-
livability.loc[
|
297 |
-
livability.loc[
|
298 |
|
299 |
|
300 |
return livability
|
|
|
249 |
|
250 |
|
251 |
subdomainsAccessibility = computeAccessibility(df_matrix,LivabilitySubdomainsInputs,alpha,threshold)
|
252 |
+
artAccessibility = computeAccessibility_pointOfInterest(df_art_matrix,'ART',alpha,threshold)
|
253 |
+
gmtAccessibility = computeAccessibility_pointOfInterest(df_art_matrix,'GMT+HSR',alpha,threshold)
|
254 |
|
255 |
+
AccessibilityInputs = pd.concat([subdomainsAccessibility, artAccessibility,gmtAccessibility], axis=1)
|
256 |
|
257 |
|
258 |
|
|
|
265 |
|
266 |
|
267 |
|
268 |
+
def accessibilityToLivability (DistanceMatrix,accessibilityInputs, SubdomainAttributeDict,UniqueDomainsList):
|
269 |
|
270 |
+
livability = pd.DataFrame(index=DistanceMatrix.index, columns=accessibilityInputs.columns)
|
271 |
|
272 |
for domain in UniqueDomainsList:
|
273 |
livability[domain] = 0
|
|
|
282 |
max_livability = float(SubdomainAttributeDict[key]['max_points'])
|
283 |
domains = [str(item) for item in SubdomainAttributeDict[key]['domain']]
|
284 |
|
285 |
+
if key in accessibilityInputs.columns and key != 'commercial':
|
286 |
+
livability_score = remap(accessibilityInputs[key], 0, threshold, 0, max_livability)
|
287 |
+
livability.loc[accessibilityInputs[key] >= threshold, key] = max_livability
|
288 |
+
livability.loc[accessibilityInputs[key] < threshold, key] = livability_score
|
289 |
if any(domains):
|
290 |
for domain in domains:
|
291 |
if domain != 'Workplaces':
|
292 |
+
livability.loc[accessibilityInputs[key] >= threshold, domain] += max_livability
|
293 |
+
livability.loc[accessibilityInputs[key] < threshold, domain] += livability_score
|
294 |
|
295 |
elif key == 'commercial':
|
296 |
+
livability_score = remap(accessibilityInputs['jobs'], 0, threshold, 0, max_livability)
|
297 |
+
livability.loc[accessibilityInputs['jobs'] >= threshold, domains[0]] = max_livability
|
298 |
+
livability.loc[accessibilityInputs['jobs'] < threshold, domains[0]] = livability_score
|
299 |
|
300 |
|
301 |
return livability
|