code: def _calculate_combined_df_with_metadata(
      results: Iterable[AttackResults],
  ):
      """Adds metadata to the dataframe and concats them together."""
      all_results_df = None
      for attack_results in results:
          attack_results_df = attack_results.calculate_pd_dataframe()
          attack_results_df = attack_results_df.loc[
              attack_results_df[
                  str(AttackResultsDFColumns.SLICE_FEATURE)
              ]
              == ENTIRE_DATASET_SLICE_STR
          ]
          attack_results_df.insert(
              0,
              EPOCH_STR,
              attack_results.privacy_report_metadata.epoch_num,
          )
          attack_results_df.insert(
              0,
              TRAIN_ACCURACY_STR,
              attack_results.privacy_report_metadata.accuracy_train,
          )
          attack_results_df.insert(
              0,
              LEGEND_LABEL_STR,
              attack_results.privacy_report_metadata.model_variant_label
              + " - "
              + attack_results_df[
                  str(AttackResultsDFColumns.ATTACK_TYPE)
              ],
          )
          if all_results_df is None:
              all_results_df = attack_results_df
          else:
              all_results_df = pd.concat(
                  [all_results_df, attack_results_df], ignore_index=True
              )
      return all_results_df
  
file_path: privacy/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/privacy_report.py
imports: from typing import Iterable, Sequence
  import matplotlib.pyplot
  import pandas
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackResults
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackResultsCollection
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackResultsDFColumns
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import ENTIRE_DATASET_SLICE_STR
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import PrivacyMetric
label_desc: Use image node_id 3 for calling a global function with example usage: _calculate_combined_df_with_metadata(results) and returns: all_results_df