nastasiasnk commited on
Commit
ea9bc33
1 Parent(s): a5fefb6

Update imports_utils.py

Browse files
Files changed (1) hide show
  1. imports_utils.py +8 -2
imports_utils.py CHANGED
@@ -175,7 +175,8 @@ def fetchSubdomainMapper (livabilityAttributePages):
175
 
176
 
177
  def fetchDistanceMatrices (stream_distance_matrices):
178
-
 
179
  # navigate to list with speckle objects of interest
180
  distance_matrices = {}
181
  for distM in stream_distance_matrices["@Data"]['@{0}']:
@@ -186,8 +187,13 @@ def fetchDistanceMatrices (stream_distance_matrices):
186
  origin_ids = distance_matrix_dict["origin_uuid"]
187
  destination_ids = distance_matrix_dict["destination_uuid"]
188
  distance_matrix = distance_matrix_dict["matrix"]
 
 
 
 
 
189
  # Convert the distance matrix to a DataFrame
190
- df_distances = pd.DataFrame(distance_matrix, index=origin_ids, columns=destination_ids)
191
 
192
  # i want to add the index & colum names to dist_m_csv
193
  #distance_matrices[kk] = dist_m_csv[kk]
 
175
 
176
 
177
  def fetchDistanceMatrices (stream_distance_matrices):
178
+
179
+ nested_list = []
180
  # navigate to list with speckle objects of interest
181
  distance_matrices = {}
182
  for distM in stream_distance_matrices["@Data"]['@{0}']:
 
187
  origin_ids = distance_matrix_dict["origin_uuid"]
188
  destination_ids = distance_matrix_dict["destination_uuid"]
189
  distance_matrix = distance_matrix_dict["matrix"]
190
+ chunks = distance_matrix_dict["chunks"]
191
+ for chunk in chunks:
192
+ for row_obj in chunk['@rows']:
193
+ row = row_obj['@row']
194
+ nested_list.append(row)
195
  # Convert the distance matrix to a DataFrame
196
+ df_distances = pd.DataFrame(nested_list, index=origin_ids, columns=destination_ids)
197
 
198
  # i want to add the index & colum names to dist_m_csv
199
  #distance_matrices[kk] = dist_m_csv[kk]