code: def test_metric_dataframe():
      assert recall(df_true, df_pred) == {"A": 9 / 12, "B": 9 / 15}
      assert all(
          [isnan(x) for x in recall(df0, df_pred).values()]
      ) and (recall(df0, df_pred).keys() == {"A": n, "B": n}.keys())
      assert precision(df_true, df_pred) == {"A": 9 / 15, "B": 9 / 12}
      assert f1_score(df_true, df_pred) == {
          "A": pytest.approx(2 / 3),
          "B": pytest.approx(2 / 3),
      }
      assert all(
          [isnan(x) for x in f1_score(df0, df_pred).values()]
      ) and (f1_score(df0, df_pred).keys() == {"A": n, "B": n}.keys())
      assert iou(df_true, df_pred) == {"A": 9 / 17, "B": 9 / 17}
      assert all([isnan(x) for x in iou(df0, df0).values()]) and (
          iou(df0, df0).keys() == {"A": n, "B": n}.keys()
      )
  
file_path: adtk/tests/test_metric.py
imports: from math import isnan
  import pandas
  import pytest
  from pandas import Timestamp
  from adtk.metrics import f1_score, iou, precision, recall
label_desc: Use image node_id 3 for calling a global function with example usage: test_metric_dataframe() without return types