code: def save_results(
      df,
      results_filename,
      results_format="csv",
      filename_col="filename",
  ):
      results_filename += _FMT_EXT[results_format]
      if results_format == "parquet":
          df.set_index(filename_col).to_parquet(results_filename)
      elif results_format == "json":
          df.set_index(filename_col).to_json(
              results_filename, indent=4, orient="index"
          )
      elif results_format == "json-records":
          df.to_json(results_filename, lines=True, orient="records")
      elif results_format == "json-split":
          df.to_json(
              results_filename, indent=4, orient="split", index=False
          )
      else:
          df.to_csv(results_filename, index=False)
  
file_path: pytorch-image-models/inference.py
imports: import argparse
  import json
  import logging
  import os
  import time
  from contextlib import suppress
  from functools import partial
  import numpy
  import pandas
  import torch
  from timm.data import create_dataset, create_loader, resolve_data_config, ImageNetInfo, infer_imagenet_subset
  from timm.layers import apply_test_time_pool
  from timm.models import create_model
  from timm.utils import AverageMeter, setup_default_logging, set_jit_fuser, ParseKwargs
label_desc: Use image node_id 2 for calling a global function with example usage: save_results(df, results_filename, results_format, filename_col) without return types