nastasiasnk commited on
Commit
de83467
·
verified ·
1 Parent(s): bc03b1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
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
- domain = [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(domain):
241
- for item in domain:
242
  if domain != 'Workplaces':
243
- livability.loc[subdomainsAccessibility[key] >= threshold, item] += max_livability
244
- livability.loc[subdomainsAccessibility[key] < threshold, item] += 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, domain[0]] = max_livability
250
- livability.loc[subdomainsAccessibility['jobs'] < threshold, domain[0]] = livability_score
251
- for item in subdomainsAccessibility['jobs']:
252
- if item >= threshold:
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)