title: fast way to identify pair of linestring geodataframes that are nearest neighbors
body: <p>I have a list of 90 geodataframes, all containing LineStrings that are connected to each other (imagine a MultiLineString).</p>
  <p>From this list, I would like to identify the two GDFs that are in closest proximity to each other (closest as in considering the extents of the combined linestrings of each GDF).</p>
  <p>A manual way i can imagine doing this is to populate a 90x90 matrix and call the distance function as in:</p>
  <pre><code>matrix = np.zeros((90, 90))
  gdfs = [gdf1, gdf2, gdf3, gdf4, ..., gdf90]
  
  for i, gdf_init in enumerate(gdfs):
     for j, gdf_pair in enumerate(gdfs):
        min_dist = gdf_init.distance(gdf_pair).min()
        matrix[i, j] = min_dist
  </code></pre>
  <p>And then use np.where to get the (i, j) values of the smallest min_dist value in the matrix.</p>
  <p>However, perhaps nested for loops are not the most pythonic way to go about things. Wondering if anyone has an optimized implementation recommendation for this task?</p>