code: def test_df_stability_metrics():
      # generate metrics directly from dataframe
      bin_specs = {
          "date": {
              # Note that 2000 is a leap year (366 days), timedelta cannot account for this
              # if this is important for the analysis, use an IDs for each year
              "bin_width": pd.Timedelta("365d").value,
              "bin_offset": pd.Timestamp("2000-1-1").value,
          },
          "latitude": {"bin_width": 5.0, "bin_offset": 0.0},
      }
  
      settings = Settings(
          time_axis="date",
          binning="unit",
          features=["date:isActive", "date:eyeColor", "date:latitude"],
          bin_specs=bin_specs,
      )
  
      ds = df_stability_metrics(
          df=pytest.test_df,
          settings=settings,
      )
  
      cols = ["profiles", "comparisons", "traffic_lights", "alerts"]
      for c in cols:
          assert c in list(ds.keys())
  
file_path: popmon/tests/popmon/pipeline/test_metrics.py
imports: import pandas
  import pytest
  from popmon import resources
  from popmon.base import Pipeline
  from popmon.config import Settings
  from popmon.io import JsonReader
  from popmon.pipeline.metrics import df_stability_metrics, stability_metrics
label_desc: Use image node_id 2 for calling a global function with example usage: test_df_stability_metrics() without return types