code: def convert_to_pmag_data_list(self, lst_or_dict="lst", df=None):
  
          
          if isinstance(df, type(None)):
              df = self.df
          # replace np.nan / None with ""
          df = df.where(df.notnull(), "")
          # string-i-fy everything
          df = df.astype(str)
  
          if lst_or_dict == "lst":
              return list(df.T.apply(dict))
          else:
              return {str(i[df.index.name.split(' ')[0]]): dict(i) for i in list(df.T.apply(dict))}
docs: Take MagicDataFrame and turn it into a list of dictionaries.
          This will have the same format as reading in a 2.5 file
          with pmag.magic_read(), i.e.:
          if "lst":
            [{"sample": "samp_name", "azimuth": 12, ...}, {...}]
          if "dict":
            {"samp_name": {"azimuth": 12, ...}, "samp_name2": {...}, ...}
          NOTE: "dict" not recommended with 3.0, as one sample can have
          many rows, which means that dictionary items can be overwritten