code: def get_confusion_count_dataframes(
      confusion: Iterable[feature_skew_results_pb2.ConfusionCount],
  ) -> Dict[str, pd.DataFrame]:
      """Returns a pandas dataframe representation of a sequence of ConfusionCount.
  
      Args:
        confusion: An interable over ConfusionCount protos.
      Returns: A map from feature name to a pandas dataframe containing match counts
        along with base and test counts for all unequal value pairs in the input.
      """
      confusion = list(confusion)
      confusion_per_feature = collections.defaultdict(list)
      for c in confusion:
          confusion_per_feature[c.feature_name].append(c)
  
      def _build_df(confusion):
          base_count_per_value = collections.defaultdict(lambda: 0)
          test_count_per_value = collections.defaultdict(lambda: 0)
          value_counts = []
          for c in confusion:
              base_count_per_value[c.base.bytes_value] += c.count
              test_count_per_value[c.test.bytes_value] += c.count
              value_counts.append(
                  (c.base.bytes_value, c.test.bytes_value, c.count)
              )
          df = pd.DataFrame(
              value_counts,
              columns=("Base value", "Test value", "Pair count"),
          )
          df["Base count"] = df["Base value"].apply(
              lambda x: base_count_per_value[x]
          )
          df["Test count"] = df["Test value"].apply(
              lambda x: test_count_per_value[x]
          )
          df["Fraction of base"] = df["Pair count"] / df["Base count"]
          df = (
              df[df["Base value"] != df["Test value"]]
              .sort_values(["Base value", "Fraction of base"])
              .reset_index(drop=True)
          )
          return df[
              [
                  "Base value",
                  "Test value",
                  "Pair count",
                  "Base count",
                  "Test count",
              ]
          ]
  
      return {k: _build_df(v) for k, v in confusion_per_feature.items()}
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import base64
  import collections
  import sys
  from typing import Dict, Iterable, List, Optional, Text, Tuple, Union
  import pandas
  from tensorflow_data_validation import types
  from tensorflow_data_validation.skew.protos import feature_skew_results_pb2
  from tensorflow_data_validation.utils import stats_util
  from tensorflow_metadata.proto.v0 import anomalies_pb2
  from tensorflow_metadata.proto.v0 import schema_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 19 for calling a global function with example usage: get_confusion_count_dataframes(confusion) and returns: unknown, df