code: def export_csv(self, path, idx=None, header=None, formatted=False,
                     sort_idx=True, fmt='%.18e'):
          
          if not idx:
              idx = self._idx
          if not header:
              header = self.get_header(idx, formatted=formatted)
  
          assert len(idx) == len(header), \
              "Idx length does not match header length"
  
          body = self.get_values(idx)
  
          with open(path, 'w') as fd:
              fd.write(','.join(header) + '\n')
              np.savetxt(fd, body, fmt=fmt, delimiter=',')
docs: Export to a csv file
  
          Parameters
          ----------
          path : str
              path of the csv file to save
          idx : None or array-like, optional
              the indices of the variables to export. Export all by default
          header : None or array-like, optional
              customized header if not `None`. Use the names from the lst file
              by default
          formatted : bool, optional
              Use LaTeX-formatted header. Does not apply when using customized
              header
          sort_idx : bool, optional
              Sort by idx or not, # TODO: implement sort
          fmt : str
              cell formatter