code: def db_to_df(db_file, slabs=None, facet=None):
      
      systems = []
      data = []
      if slabs:
          for slab in slabs:
              data_tmp = select_data(db_file, slab=slab, facet=facet)
              data.append(data_tmp)
              subsystem = [tup[0] for i, tup in enumerate(data_tmp)]
              systems.append(list(set(subsystem))[0])
      else:
          data_tmp = select_data(db_file)
          data.append(data_tmp)
  
      df = pd.DataFrame()
      system, facet, reactants, products, reaction_energy = [], [], [], [], []
      for entry in data:
          for reaction in entry:
              system.append(str(reaction[0]))
              facet.append(str(reaction[1]))
              reactants_i = [molecule for molecule in ast.literal_eval(reaction[2]).keys()]
              reactants.append(reactants_i)
              products_i = [molecule for molecule in ast.literal_eval(reaction[3]).keys()]
              products.append(products_i)
              reaction_energy.append(float(reaction[4]))
  
      df[0] = system
      df[1] = facet
      df[2] = reactants
      df[4] = products
      df[5] = reaction_energy
  
      df.columns = ['system', 'facet', 'reactants', 'products', 'reaction_energy']
      labs = auto_labels(df)
      df['labels'] = labs
      df = df.sort_values(by=['facet', 'system'])
      df = df.reset_index(drop=True)
      return(df)
docs: Transforms database to data frame.
  
      Parameters
      ----------
      db_file : Path to database
      slabs : Which metals (slabs) to select.
      facet : Which facets to select.
  
      Returns
      -------
      df : Data frame.