code: def testAutoPivot_PlotsDataFrameCollapseColumnNames(self):
      dfs = dataframe.plots_as_dataframes(self.plots_for_slice)
      df = dataframe.auto_pivot(
          dfs.confusion_matrix_at_thresholds,
          stringify_slices=False,
          collapse_column_names=True,
      )
      expected = pd.DataFrame(
          {
              ("slices", "age"): [38.0, 38.0],
              ("slices", "sex"): [b"Female", b"Female"],
              ("plot_keys", "name"): ["", ""],
              ("plot_keys", "model_name"): ["", ""],
              ("plot_keys", "output_name"): ["", ""],
              ("plot_keys", "example_weighted"): [False, False],
              ("plot_data", "threshold"): [0.5, 0.5],
              ("plot_data", "false_negatives"): [10.0, 10.0],
              ("plot_data", "true_negatives"): [10.0, 10.0],
              ("plot_data", "false_positives"): [10.0, 10.0],
              ("plot_data", "true_positives"): [10.0, 10.0],
              ("plot_data", "precision"): [0.9, 0.9],
              ("plot_data", "recall"): [0.8, 0.8],
              ("plot_data", "false_positive_rate"): [0.0, 0.0],
              ("plot_data", "f1"): [0.0, 0.0],
              ("plot_data", "accuracy"): [0.0, 0.0],
              ("plot_data", "false_omission_rate"): [0.0, 0.0],
          }
      ).pivot(
          index=[("slices", "age"), ("slices", "sex")],
          columns=[],
          values=[
              ("plot_data", "threshold"),
              ("plot_data", "false_negatives"),
              ("plot_data", "true_negatives"),
              ("plot_data", "false_positives"),
              ("plot_data", "true_positives"),
              ("plot_data", "precision"),
              ("plot_data", "recall"),
              ("plot_data", "false_positive_rate"),
              ("plot_data", "f1"),
              ("plot_data", "accuracy"),
              ("plot_data", "false_omission_rate"),
          ],
      )
      pd.testing.assert_frame_equal(expected, df)
  
imports: import dataclasses
  import numpy
  import pandas
  import tensorflow
  from tensorflow_model_analysis.experimental import dataframe
  from tensorflow_model_analysis.proto import metrics_for_slice_pb2
  from google.protobuf import text_format
label_desc: Use image node_id 6 for calling the PlotsAsDataFrameTest obj's underlying member method code with example usage: obj.testAutoPivot_PlotsDataFrameCollapseColumnNames() without return types