Spaces:
Sleeping
Sleeping
nastasiasnk
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -231,25 +231,25 @@ def test(input_json):
|
|
231 |
for key, values in SubdomainAttributeDict.items():
|
232 |
threshold = float(SubdomainAttributeDict[key]['thresholds'])
|
233 |
max_livability = float(SubdomainAttributeDict[key]['max_points'])
|
234 |
-
|
235 |
|
236 |
if key in subdomainsAccessibility.columns and key != 'commercial':
|
237 |
livability_score = remap(subdomainsAccessibility[key], 0, threshold, 0, max_livability)
|
238 |
livability.loc[subdomainsAccessibility[key] >= threshold, key] = max_livability
|
239 |
livability.loc[subdomainsAccessibility[key] < threshold, key] = livability_score
|
240 |
-
if any(
|
241 |
-
for
|
242 |
if domain != 'Workplaces':
|
243 |
-
livability.loc[subdomainsAccessibility[key] >= threshold,
|
244 |
-
livability.loc[subdomainsAccessibility[key] < threshold,
|
245 |
|
246 |
|
247 |
elif key == 'commercial':
|
248 |
livability_score = remap(subdomainsAccessibility['jobs'], 0, threshold, 0, max_livability)
|
249 |
-
livability.loc[subdomainsAccessibility['jobs'] >= threshold,
|
250 |
-
livability.loc[subdomainsAccessibility['jobs'] < threshold,
|
251 |
-
for
|
252 |
-
if
|
253 |
templist.append(max_livability)
|
254 |
else:
|
255 |
templist.append(livability_score)
|
|
|
231 |
for key, values in SubdomainAttributeDict.items():
|
232 |
threshold = float(SubdomainAttributeDict[key]['thresholds'])
|
233 |
max_livability = float(SubdomainAttributeDict[key]['max_points'])
|
234 |
+
domains = [str(item) for item in SubdomainAttributeDict[key]['domain']]
|
235 |
|
236 |
if key in subdomainsAccessibility.columns and key != 'commercial':
|
237 |
livability_score = remap(subdomainsAccessibility[key], 0, threshold, 0, max_livability)
|
238 |
livability.loc[subdomainsAccessibility[key] >= threshold, key] = max_livability
|
239 |
livability.loc[subdomainsAccessibility[key] < threshold, key] = livability_score
|
240 |
+
if any(domains):
|
241 |
+
for domain in domains:
|
242 |
if domain != 'Workplaces':
|
243 |
+
livability.loc[subdomainsAccessibility[key] >= threshold, domain] += max_livability
|
244 |
+
livability.loc[subdomainsAccessibility[key] < threshold, domain] += livability_score
|
245 |
|
246 |
|
247 |
elif key == 'commercial':
|
248 |
livability_score = remap(subdomainsAccessibility['jobs'], 0, threshold, 0, max_livability)
|
249 |
+
livability.loc[subdomainsAccessibility['jobs'] >= threshold, domains[0]] = max_livability
|
250 |
+
livability.loc[subdomainsAccessibility['jobs'] < threshold, domains[0]] = livability_score
|
251 |
+
for value in subdomainsAccessibility['jobs']:
|
252 |
+
if value >= threshold:
|
253 |
templist.append(max_livability)
|
254 |
else:
|
255 |
templist.append(livability_score)
|