code: def test_compare_after_pivot():
      pivot_df = pp.pivot(
          df=multiple_metrics_df,
          index=["dttm"],
          columns=["country"],
          aggregates={
              "sum_metric": {"operator": "sum"},
              "count_metric": {"operator": "sum"},
          },
      )
      """
                     count_metric    sum_metric
      country              UK US         UK US
      dttm
      2019-01-01            1  2          5  6
      2019-01-02            3  4          7  8
      """
      compared_df = pp.compare(
          pivot_df,
          source_columns=["count_metric"],
          compare_columns=["sum_metric"],
          compare_type=PPC.DIFF,
          drop_original_columns=True,
      )
      """
                 difference__count_metric__sum_metric
      country                                      UK US
      dttm
      2019-01-01                                   -4 -4
      2019-01-02                                   -4 -4
      """
      flat_df = pp.flatten(compared_df)
      """
              dttm  difference__count_metric__sum_metric, UK  difference__count_metric__sum_metric, US
      0 2019-01-01                                        -4                                        -4
      1 2019-01-02                                        -4                                        -4
      """
      assert flat_df.equals(
          pd.DataFrame(
              data={
                  "dttm": pd.to_datetime(["2019-01-01", "2019-01-02"]),
                  FLAT_COLUMN_SEPARATOR.join(
                      ["difference__count_metric__sum_metric", "UK"]
                  ): [-4, -4],
                  FLAT_COLUMN_SEPARATOR.join(
                      ["difference__count_metric__sum_metric", "US"]
                  ): [-4, -4],
              }
          )
      )
  
file_path: superset/tests/unit_tests/pandas_postprocessing/test_compare.py
imports: import pandas
  from superset.constants import PandasPostprocessingCompare
  from superset.utils import pandas_postprocessing
  from superset.utils.pandas_postprocessing.utils import FLAT_COLUMN_SEPARATOR
  from tests.unit_tests.fixtures.dataframes import multiple_metrics_df, timeseries_df2
label_desc: Use image node_id 6 for calling a global function with example usage: test_compare_after_pivot() without return types