nastasiasnk commited on
Commit
56dd4bf
1 Parent(s): 7cdf6fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -233,22 +233,23 @@ def test(input_json):
233
  max_livability = float(SubdomainAttributeDict[key]['max_points'])
234
  domain = [str(item) for item in SubdomainAttributeDict[key]['domain']]
235
 
236
- if key == 'commercial':
237
- livability_score = remap(subdomainsAccessibility['jobs'], 0, threshold, 0, max_livability)
238
- livability.loc[subdomainsAccessibility['jobs'] >= threshold, domain[0]] = max_livability
239
- livability.loc[subdomainsAccessibility['jobs'] < threshold, domain[0]] = livability_score
240
-
241
- elif key in subdomainsAccessibility.columns and key != 'commercial':
242
  livability_score = remap(subdomainsAccessibility[key], 0, threshold, 0, max_livability)
243
  livability.loc[subdomainsAccessibility[key] >= threshold, key] = max_livability
244
- livability.loc[subdomainsAccessibility[key] < threshold, key] = livability_score
245
- """
246
  if any(domain):
247
  for item in domain:
248
  if domain != 'Workplaces':
249
  livability.loc[subdomainsAccessibility[key] >= threshold, item] += max_livability
250
  livability.loc[subdomainsAccessibility[key] < threshold, item] += livability_score
251
- """
 
 
 
 
 
 
 
252
 
253
  #livability = livability.rename(columns={'jobs': 'Workplaces'})
254
 
 
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
+ livability['Workplaces'] = 0
247
+
248
+ elif key == 'commercial':
249
+ livability_score = remap(subdomainsAccessibility['jobs'], 0, threshold, 0, max_livability)
250
+ livability.loc[subdomainsAccessibility['jobs'] >= threshold, domain[0]] = max_livability
251
+ livability.loc[subdomainsAccessibility['jobs'] < threshold, domain[0]] = livability_score
252
+
253
 
254
  #livability = livability.rename(columns={'jobs': 'Workplaces'})
255