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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -225,7 +225,7 @@ def test(input_json):
225
 
226
  #livability.drop(columns='Workplaces', inplace=True)
227
 
228
-
229
  # remap accessibility to livability points
230
 
231
  for key, values in SubdomainAttributeDict.items():
@@ -243,22 +243,23 @@ def test(input_json):
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
 
256
- return livability
257
 
258
 
259
 
260
 
261
- livability = accessibilityToLivability(df_matrix,subdomainsAccessibility,attributeMapperDict,domainsUnique)
262
 
263
 
264
  livability_dictionary = livability.to_dict('index')
@@ -271,7 +272,8 @@ def test(input_json):
271
  "livability_dictionary": livability_dictionary,
272
  "subdomainsWeights_dictionary": LivabilitySubdomainsInputs_dictionary,
273
  "luDomainMapper": landuseMapperDict,
274
- "attributeMapper": attributeMapperDict
 
275
  }
276
 
277
 
 
225
 
226
  #livability.drop(columns='Workplaces', inplace=True)
227
 
228
+ templist = []
229
  # remap accessibility to livability points
230
 
231
  for key, values in SubdomainAttributeDict.items():
 
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
+ if subdomainsAccessibility['jobs'] >= threshold:
252
+ templist.append(max_livability)
253
+ else:
254
+ templist.append(livability_score)
255
  #livability = livability.rename(columns={'jobs': 'Workplaces'})
256
 
257
+ return [livability, templist]
258
 
259
 
260
 
261
 
262
+ livability, templist = accessibilityToLivability(df_matrix,subdomainsAccessibility,attributeMapperDict,domainsUnique)
263
 
264
 
265
  livability_dictionary = livability.to_dict('index')
 
272
  "livability_dictionary": livability_dictionary,
273
  "subdomainsWeights_dictionary": LivabilitySubdomainsInputs_dictionary,
274
  "luDomainMapper": landuseMapperDict,
275
+ "attributeMapper": attributeMapperDict,
276
+ "workplaces":templist
277
  }
278
 
279