Spaces:
Sleeping
Sleeping
nastasiasnk
commited on
Update imports_utils.py
Browse files- imports_utils.py +33 -1
imports_utils.py
CHANGED
@@ -173,7 +173,7 @@ def fetchSubdomainMapper (livabilityAttributePages):
|
|
173 |
|
174 |
|
175 |
|
176 |
-
|
177 |
def fetchDistanceMatrices (stream_distance_matrices):
|
178 |
|
179 |
# navigate to list with speckle objects of interest
|
@@ -196,6 +196,38 @@ def fetchDistanceMatrices (stream_distance_matrices):
|
|
196 |
pass
|
197 |
|
198 |
return distance_matrices
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
|
200 |
|
201 |
|
|
|
173 |
|
174 |
|
175 |
|
176 |
+
|
177 |
def fetchDistanceMatrices (stream_distance_matrices):
|
178 |
|
179 |
# navigate to list with speckle objects of interest
|
|
|
196 |
pass
|
197 |
|
198 |
return distance_matrices
|
199 |
+
|
200 |
+
"""
|
201 |
+
|
202 |
+
def fetchDistanceMatrices (stream_distance_matrices):
|
203 |
+
|
204 |
+
# navigate to list with speckle objects of interest
|
205 |
+
distance_matrices = {}
|
206 |
+
|
207 |
+
destUUID = matrixObj.__getitem__('@destinationUUID')
|
208 |
+
oriUUID = matrixObj.__getitem__('@originUUID')
|
209 |
+
chunks = matrixObj.__getitem__('@chunks')
|
210 |
+
|
211 |
+
for distM in stream_distance_matrices["@Data"]['@{0}']:
|
212 |
+
for kk in distM.__dict__.keys():
|
213 |
+
try:
|
214 |
+
if kk.split("+")[1].startswith("distance_matrix"):
|
215 |
+
distance_matrix_dict = json.loads(distM[kk])
|
216 |
+
origin_ids = distance_matrix_dict["origin_uuid"]
|
217 |
+
destination_ids = distance_matrix_dict["destination_uuid"]
|
218 |
+
distance_matrix = distance_matrix_dict["matrix"]
|
219 |
+
|
220 |
+
# Convert the distance matrix to a DataFrame
|
221 |
+
df_distances = pd.DataFrame(distance_matrix, index=origin_ids, columns=destination_ids)
|
222 |
+
|
223 |
+
# i want to add the index & colum names to dist_m_csv
|
224 |
+
#distance_matrices[kk] = dist_m_csv[kk]
|
225 |
+
distance_matrices[kk] = df_distances
|
226 |
+
except:
|
227 |
+
pass
|
228 |
+
|
229 |
+
return distance_matrices
|
230 |
+
"""
|
231 |
|
232 |
|
233 |
|