nastasiasnk commited on
Commit
7a4a991
1 Parent(s): 9125b7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -124,7 +124,7 @@ def test(input_json):
124
 
125
  WorkplacesNumber = FindWorkplaces(df_matrix,attributeMapperDict,LivabilitySubdomainsWeights,subdomainsUnique)
126
 
127
- LivabilitySubdomainsWeights =pd.concat([LivabilitySubdomainsWeights, WorkplacesNumber], axis=1)
128
 
129
  # make a dictionary to output in grasshopper / etc
130
  LivabilitySubdomainsWeights_dictionary = LivabilitySubdomainsWeights.to_dict('index')
@@ -145,7 +145,7 @@ def test(input_json):
145
 
146
  return subdomainsAccessibility
147
 
148
- subdomainsAccessibility = computeAccessibility(df_matrix,subdomainsUnique,LivabilitySubdomainsWeights,alpha,threshold)
149
 
150
  # make a dictionary to output in grasshopper / etc
151
  subdomainsAccessibility_dictionary = subdomainsAccessibility.to_dict('index')
@@ -155,13 +155,18 @@ def test(input_json):
155
  return C_min + (((value - B_min) / (B_max - B_min))* (C_max - C_min))
156
 
157
 
 
 
 
 
158
 
159
  def accessibilityToLivability (DistanceMatrix,subdomainsAccessibility, SubdomainAttributeDict,UniqueDomainsList):
160
 
161
  livability = pd.DataFrame(index=DistanceMatrix.index, columns=subdomainsAccessibility.columns)
 
 
162
  livability.fillna(0, inplace=True)
163
 
164
-
165
 
166
  for domain in UniqueDomainsList:
167
  livability[domain] = 0
 
124
 
125
  WorkplacesNumber = FindWorkplaces(df_matrix,attributeMapperDict,LivabilitySubdomainsWeights,subdomainsUnique)
126
 
127
+ LivabilitySubdomainsInputs =pd.concat([LivabilitySubdomainsWeights, WorkplacesNumber], axis=1)
128
 
129
  # make a dictionary to output in grasshopper / etc
130
  LivabilitySubdomainsWeights_dictionary = LivabilitySubdomainsWeights.to_dict('index')
 
145
 
146
  return subdomainsAccessibility
147
 
148
+ subdomainsAccessibility = computeAccessibility(df_matrix,subdomainsUnique,LivabilitySubdomainsInputs,alpha,threshold)
149
 
150
  # make a dictionary to output in grasshopper / etc
151
  subdomainsAccessibility_dictionary = subdomainsAccessibility.to_dict('index')
 
155
  return C_min + (((value - B_min) / (B_max - B_min))* (C_max - C_min))
156
 
157
 
158
+ if 'jobs' not in subdomainsAccessibility.columns:
159
+ print("Error: Column 'jobs' does not exist in the subdomainsAccessibility.")
160
+
161
+
162
 
163
  def accessibilityToLivability (DistanceMatrix,subdomainsAccessibility, SubdomainAttributeDict,UniqueDomainsList):
164
 
165
  livability = pd.DataFrame(index=DistanceMatrix.index, columns=subdomainsAccessibility.columns)
166
+ livability.drop(columns='jobs', inplace=True)
167
+ livability["Workplaces"] = 0
168
  livability.fillna(0, inplace=True)
169
 
 
170
 
171
  for domain in UniqueDomainsList:
172
  livability[domain] = 0