Spaces:
Sleeping
Sleeping
nastasiasnk
commited on
Commit
•
9c82a2c
1
Parent(s):
a0d7355
Update app.py
Browse files
app.py
CHANGED
@@ -166,10 +166,10 @@ def test(input_json):
|
|
166 |
|
167 |
df_LivabilitySubdomainsWorkplaces = pd.DataFrame(0, index=DistanceMatrix.index, columns=['jobs'])
|
168 |
|
169 |
-
for
|
170 |
for key, value_list in SubdomainAttributeDict.items():
|
171 |
-
sqm_per_empl = float(SubdomainAttributeDict[
|
172 |
-
if key in destinationWeights.columns and key ==
|
173 |
if sqm_per_empl > 0:
|
174 |
df_LivabilitySubdomainsWorkplaces['jobs'] += (round(destinationWeights[key] / sqm_per_empl,2)).fillna(0)
|
175 |
else:
|
@@ -217,8 +217,6 @@ def test(input_json):
|
|
217 |
def accessibilityToLivability (DistanceMatrix,subdomainsAccessibility, SubdomainAttributeDict,UniqueDomainsList):
|
218 |
|
219 |
livability = pd.DataFrame(index=DistanceMatrix.index, columns=subdomainsAccessibility.columns)
|
220 |
-
#livability.drop(columns='jobs', inplace=True)
|
221 |
-
#livability["Workplaces"] = 0
|
222 |
|
223 |
for domain in UniqueDomainsList:
|
224 |
livability[domain] = 0
|
@@ -240,7 +238,7 @@ def test(input_json):
|
|
240 |
livability.loc[subdomainsAccessibility['jobs'] >= threshold, 'Workplaces'] = max_livability
|
241 |
livability.loc[subdomainsAccessibility['jobs'] < threshold, 'Workplaces'] = livability_score
|
242 |
|
243 |
-
|
244 |
livability_score = remap(subdomainsAccessibility[key], 0, threshold, 0, max_livability)
|
245 |
livability.loc[subdomainsAccessibility[key] >= threshold, key] = max_livability
|
246 |
livability.loc[subdomainsAccessibility[key] < threshold, key] = livability_score
|
|
|
166 |
|
167 |
df_LivabilitySubdomainsWorkplaces = pd.DataFrame(0, index=DistanceMatrix.index, columns=['jobs'])
|
168 |
|
169 |
+
for subdomain in UniqueSubdomainsList:
|
170 |
for key, value_list in SubdomainAttributeDict.items():
|
171 |
+
sqm_per_empl = float(SubdomainAttributeDict[subdomain]['sqmPerEmpl'][0])
|
172 |
+
if key in destinationWeights.columns and key == subdomain:
|
173 |
if sqm_per_empl > 0:
|
174 |
df_LivabilitySubdomainsWorkplaces['jobs'] += (round(destinationWeights[key] / sqm_per_empl,2)).fillna(0)
|
175 |
else:
|
|
|
217 |
def accessibilityToLivability (DistanceMatrix,subdomainsAccessibility, SubdomainAttributeDict,UniqueDomainsList):
|
218 |
|
219 |
livability = pd.DataFrame(index=DistanceMatrix.index, columns=subdomainsAccessibility.columns)
|
|
|
|
|
220 |
|
221 |
for domain in UniqueDomainsList:
|
222 |
livability[domain] = 0
|
|
|
238 |
livability.loc[subdomainsAccessibility['jobs'] >= threshold, 'Workplaces'] = max_livability
|
239 |
livability.loc[subdomainsAccessibility['jobs'] < threshold, 'Workplaces'] = 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
|