code: def _get_lantern_format(self, df):
      
  
      if ('count' not in df) or ('feature' not in df):
        raise Exception('No "count" or "feature" found in data.')
      if len(df.columns) < 3:
        raise Exception('Need at least one metrics column.')
      if len(df) == 0:
        raise Exception('Data is empty')
  
      data = []
      for _, row in df.iterrows():
        metric_values = dict(row)
        feature = metric_values.pop('feature')
        data.append({'feature': feature, 'metricValues': metric_values})
      return data
docs: Feature slice view browser expects data in the format of:
            {"metricValues": {"count": 12, "accuracy": 1.0}, "feature": "species:Iris-setosa"}
            {"metricValues": {"count": 11, "accuracy": 0.72}, "feature": "species:Iris-versicolor"}
            ...
          This function converts a DataFrame to such format.