code: def concat_nd_pickles(self, mv_grid_districts):
      
  
      pickle_name = cfg_ding0.get('output', 'nd_pickle')
      # self.nd = self.read_pickles_from_files(pickle_name)
  
      # TODO: instead of passing a list of mvgd's, pass list of filenames plus optionally a basth_path
      for mvgd in mv_grid_districts[1:]:
  
          filename = os.path.join(
              self.base_path,
              'results', pickle_name.format(mvgd))
          if os.path.isfile(filename):
              mvgd_pickle = pickle.load(open(filename, 'rb'))
              if mvgd_pickle._mv_grid_districts:
                  mvgd.add_mv_grid_district(mvgd_pickle._mv_grid_districts[0])
  
      # save to concatenated pickle
      pickle.dump(mvgd,
                  open(os.path.join(
                      self.base_path,
                      'results',
                      "ding0_grids_{0}-{1}.pkl".format(
                          mv_grid_districts[0],
                          mv_grid_districts[-1])),
                      "wb"))
  
      # save stats (edges and nodes data) to csv
      nodes, edges = mvgd.to_dataframe()
      nodes.to_csv(os.path.join(
          self.base_path,
          'results', 'mvgd_nodes_stats_{0}-{1}.csv'.format(
              mv_grid_districts[0], mv_grid_districts[-1])),
          index=False)
      edges.to_csv(os.path.join(
          self.base_path,
          'results', 'mvgd_edges_stats_{0}-{1}.csv'.format(
              mv_grid_districts[0], mv_grid_districts[-1])),
          index=False)
docs: Read multiple pickles, join nd objects and save to file
  
      Parameters
      ----------
      mv_grid_districts : list
          Ints describing MV grid districts