Spaces:
Sleeping
Sleeping
nastasiasnk
commited on
Commit
•
34833f4
1
Parent(s):
656cba8
Update app.py
Browse files
app.py
CHANGED
@@ -99,21 +99,21 @@ def test(input_json):
|
|
99 |
# remap accessibility to livability points
|
100 |
|
101 |
for key, values in SubdomainAttributeDict.items():
|
102 |
-
threshold = float(SubdomainAttributeDict[key]['thresholds'])
|
103 |
-
max_livability = float(SubdomainAttributeDict[key]['max_points'])
|
104 |
-
domain = [str(item) for item in SubdomainAttributeDict[key]['domain']]
|
105 |
-
sqm_per_employee = SubdomainAttributeDict[key]['sqmPerEmpl']
|
106 |
-
|
107 |
if key in subdomainsAccessibility.columns:
|
|
|
|
|
|
|
|
|
|
|
108 |
livability_score = remap(subdomainsAccessibility[key], 0, threshold, 0, max_livability)
|
109 |
livability.loc[subdomainsAccessibility[key] >= threshold, key] = max_livability
|
110 |
livability.loc[subdomainsAccessibility[key] < threshold, key] = livability_score
|
|
|
111 |
if any(domain):
|
112 |
for item in domain:
|
113 |
livability.loc[subdomainsAccessibility[key] >= threshold, domain] += max_livability
|
114 |
livability.loc[subdomainsAccessibility[key] < threshold, domain] += livability_score
|
115 |
-
|
116 |
-
livability.loc[subdomainsAccessibility[key] < threshold, domain] += 10
|
117 |
|
118 |
return livability
|
119 |
|
|
|
99 |
# remap accessibility to livability points
|
100 |
|
101 |
for key, values in SubdomainAttributeDict.items():
|
|
|
|
|
|
|
|
|
|
|
102 |
if key in subdomainsAccessibility.columns:
|
103 |
+
domain = [str(item) for item in SubdomainAttributeDict[key]['domain']]
|
104 |
+
threshold = float(SubdomainAttributeDict[key]['thresholds'])
|
105 |
+
max_livability = float(SubdomainAttributeDict[key]['max_points'])
|
106 |
+
sqm_per_employee = SubdomainAttributeDict[key]['sqmPerEmpl']
|
107 |
+
|
108 |
livability_score = remap(subdomainsAccessibility[key], 0, threshold, 0, max_livability)
|
109 |
livability.loc[subdomainsAccessibility[key] >= threshold, key] = max_livability
|
110 |
livability.loc[subdomainsAccessibility[key] < threshold, key] = livability_score
|
111 |
+
|
112 |
if any(domain):
|
113 |
for item in domain:
|
114 |
livability.loc[subdomainsAccessibility[key] >= threshold, domain] += max_livability
|
115 |
livability.loc[subdomainsAccessibility[key] < threshold, domain] += livability_score
|
116 |
+
|
|
|
117 |
|
118 |
return livability
|
119 |
|