code: def convert_and_print_dataframe(
      output_attribute_label_assoc_map,
      model_name,
      label_assoc_mapping,
      threshold,
      topk,
  ):
      assoc_names = list(label_assoc_mapping.keys())
      attributes_list = []
      for key, value in list(output_attribute_label_assoc_map.items()):
          if isinstance(value, dict):
              attributes_list.extend(sorted(value.keys()))
          else:
              attributes_list.append(key)
      attributes_list.remove("n/a")
      attributes_list.remove("n/a_lighter")
      attributes_list.remove("n/a_darker")
      attributes_list.remove("unknown")
  
      flattened_output_attribute_label_assoc_map = {}
      for entry in list(output_attribute_label_assoc_map.values()):
          flattened_output_attribute_label_assoc_map.update(entry)
  
      dataframe = {"t_topk": [], "model": [], "association": []}
      for item in attributes_list:
          dataframe[item] = []
  
      for assoc in assoc_names:
          t_topk = f"t={threshold}, top-{topk}"
          dataframe["model"].append(model_name)
          dataframe["association"].append(assoc)
          dataframe["t_topk"].append(t_topk)
          for key, value in list(
              flattened_output_attribute_label_assoc_map.items()
          ):
              if key not in dataframe:
                  continue
              if assoc not in value:
                  continue
              dataframe[key].append(value[assoc])
  
      df = pd.DataFrame(data=dataframe)
      print(df.to_markdown())
      return df
  
file_path: vissl/projects/fairness_indicators/harmful_label_associations/inference_label_assoc_openimages_miap_test.py
imports: import matplotlib.pyplot
  import numpy
  import pandas
  import torchvision.transforms
  from fvcore.common.file_io import PathManager
  from PIL import Image
  from vissl.utils.io import load_file
label_desc: Use image node_id 7 for calling a global function with example usage: convert_and_print_dataframe(output_attribute_label_assoc_map, model_name, label_assoc_mapping, threshold, topk) and returns: df