Spaces:
Sleeping
Sleeping
nastasiasnk
commited on
Commit
•
a68aa72
1
Parent(s):
c23380f
Update imports_utils.py
Browse files- imports_utils.py +17 -0
imports_utils.py
CHANGED
@@ -241,3 +241,20 @@ def splitDictByStrFragmentInColumnName(original_dict, substrings):
|
|
241 |
return result_dicts
|
242 |
|
243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
return result_dicts
|
242 |
|
243 |
|
244 |
+
def landusesToSubdomains(DistanceMatrix, LanduseDf, LanduseToSubdomainDict, UniqueSubdomainsList):
|
245 |
+
df_LivabilitySubdomainsArea = pd.DataFrame(0, index=DistanceMatrix.index, columns=UniqueSubdomainsList)
|
246 |
+
|
247 |
+
for subdomain in UniqueSubdomainsList:
|
248 |
+
for lu, lu_subdomain in LanduseToSubdomainDict.items():
|
249 |
+
if lu_subdomain == subdomain:
|
250 |
+
if lu in LanduseDf.columns:
|
251 |
+
df_LivabilitySubdomainsArea[subdomain] = df_LivabilitySubdomainsArea[subdomain].add(LanduseDf[lu], fill_value=0)
|
252 |
+
else:
|
253 |
+
print(f"Warning: Column '{lu}' not found in landuse database")
|
254 |
+
|
255 |
+
return df_LivabilitySubdomainsArea
|
256 |
+
|
257 |
+
|
258 |
+
|
259 |
+
|
260 |
+
|