nastasiasnk commited on
Commit
87f9d6f
1 Parent(s): 9f66294

Update imports_utils.py

Browse files
Files changed (1) hide show
  1. imports_utils.py +11 -8
imports_utils.py CHANGED
@@ -233,14 +233,17 @@ def FindWorkplacesNumber (DistanceMatrix,SubdomainAttributeDict,destinationWeigh
233
  df_LivabilitySubdomainsWorkplaces = pd.DataFrame(0, index=DistanceMatrix.index, columns=['jobs'])
234
 
235
  for subdomain in UniqueSubdomainsList:
236
- for key, value_list in SubdomainAttributeDict.items():
237
- sqm_per_empl = float(SubdomainAttributeDict[subdomain]['sqmPerEmpl'])
238
- if key in destinationWeights.columns and key == subdomain:
239
- if sqm_per_empl > 0:
240
- df_LivabilitySubdomainsWorkplaces['jobs'] += (round(destinationWeights[key] / sqm_per_empl,2)).fillna(0)
241
- else:
242
- df_LivabilitySubdomainsWorkplaces['jobs'] += 0
243
-
 
 
 
244
  return df_LivabilitySubdomainsWorkplaces
245
 
246
 
 
233
  df_LivabilitySubdomainsWorkplaces = pd.DataFrame(0, index=DistanceMatrix.index, columns=['jobs'])
234
 
235
  for subdomain in UniqueSubdomainsList:
236
+ for key, value_list in SubdomainAttributeDict.items():
237
+ if value_list['sqmPerEmpl']:
238
+ sqm_per_empl = float(SubdomainAttributeDict[subdomain]['sqmPerEmpl'])
239
+ if key in destinationWeights.columns and key == subdomain:
240
+ if sqm_per_empl > 0:
241
+ df_LivabilitySubdomainsWorkplaces['jobs'] += (round(destinationWeights[key] / sqm_per_empl,2)).fillna(0)
242
+ else:
243
+ df_LivabilitySubdomainsWorkplaces['jobs'] += 0
244
+ else:
245
+ df_LivabilitySubdomainsWorkplaces['jobs'] += 0
246
+
247
  return df_LivabilitySubdomainsWorkplaces
248
 
249