code: def test_expanding_hist_comparer():
      hist_list = [
          "date:country",
          "date:bankrupt",
          "date:num_employees",
          "date:A_score",
      ]
      features = ["country", "bankrupt", "num_employees", "A_score"]
  
      cols = [
          "expanding_pearson",
          "expanding_chi2",
          "expanding_chi2_zscore",
          "expanding_chi2_norm",
          "expanding_chi2_pvalue",
          "expanding_chi2_max_residual",
          "expanding_chi2_spike_count",
          "expanding_ks",
          "expanding_ks_zscore",
          "expanding_ks_pvalue",
          "expanding_max_prob_diff",
          "expanding_jsd",
          "expanding_psi",
          "expanding_unknown_labels",
      ]
  
      pipeline = Pipeline(
          modules=[
              JsonReader(
                  file_path=resources.data("example_histogram.json"),
                  store_key="example_hist",
              ),
              HistSplitter(
                  read_key="example_hist",
                  store_key="output_hist",
                  features=hist_list,
              ),
              ExpandingHistComparer(
                  read_key="output_hist", store_key="comparison"
              ),
          ]
      )
      datastore = pipeline.transform(datastore={})
  
      assert "comparison" in datastore and isinstance(
          datastore["comparison"], dict
      )
      assert len(datastore["comparison"].keys()) == len(features)
      for f in features:
          assert f in datastore["comparison"]
      for f in features:
          assert isinstance(datastore["comparison"][f], pd.DataFrame)
  
      df = datastore["comparison"]["A_score"]
      assert len(df) == 16
      np.testing.assert_array_equal(sorted(df.columns), sorted(cols))
      np.testing.assert_almost_equal(
          df["expanding_chi2"].mean(), 2.8366236044275257
      )
  
      df = datastore["comparison"]["country"]
      assert len(df) == 17
      np.testing.assert_array_equal(sorted(df.columns), sorted(cols))
      np.testing.assert_almost_equal(
          df["expanding_chi2"].mean(), 1.1224348056645368
      )
  
      df = datastore["comparison"]["bankrupt"]
      assert len(df) == 17
      np.testing.assert_array_equal(sorted(df.columns), sorted(cols))
      np.testing.assert_almost_equal(
          df["expanding_chi2"].mean(), 0.6901425387043608
      )
  
      df = datastore["comparison"]["num_employees"]
      assert len(df) == 17
      np.testing.assert_array_equal(sorted(df.columns), sorted(cols))
      np.testing.assert_almost_equal(
          df["expanding_chi2"].mean(), 4.243731870738727
      )
  
file_path: popmon/tests/popmon/analysis/comparison/test_hist_comparer.py
imports: import numpy
  import pandas
  import pytest
  from popmon import resources
  from popmon.analysis.apply_func import ApplyFunc
  from popmon.analysis.comparison.hist_comparer import ExpandingHistComparer, ReferenceHistComparer, RollingHistComparer, hist_compare
  from popmon.analysis.functions import expanding_hist
  from popmon.base import Pipeline
  from popmon.hist.hist_splitter import HistSplitter
  from popmon.io import JsonReader
label_desc: Use image node_id 3 for calling a global function with example usage: test_expanding_hist_comparer() without return types