code: def test_get_aggregated_data():
      dl = DataLoader()
      test_df = pd.DataFrame(
          {
              TIME_COL: pd.date_range(
                  "2020-01-01 00:00", "2020-12-31 23:30", freq="0.5H"
              ),
              "col1": 1,
              "col2": 2,
              "col3": 3,
              "col4": 4,
              "col5": 5,
          }
      )
      agg_func = {
          "col1": "sum",
          "col2": "mean",
          "col3": "median",
          "col4": "min",
          "col5": "max",
      }
      # For each frequency,
      # (1) make sure the `TIME_COL` column is correctly included
      # (2) verify the aggregation part works correctly
      # Hourly aggregation
      df = dl.get_aggregated_data(
          test_df, agg_freq="hourly", agg_func=agg_func
      )
      assert df.shape == (366 * 24, len(agg_func) + 1)
      assert (df["col1"] != 1 * 2).sum() == 0
      assert (df["col2"] != 2).sum() == 0
      assert (df["col3"] != 3).sum() == 0
      assert (df["col4"] != 4).sum() == 0
      assert (df["col5"] != 5).sum() == 0
      # Daily aggregation
      df = dl.get_aggregated_data(
          test_df, agg_freq="daily", agg_func=agg_func
      )
      assert df.shape == (366, len(agg_func) + 1)
      assert (df["col1"] != 24 * 2).sum() == 0
      assert (df["col2"] != 2).sum() == 0
      assert (df["col3"] != 3).sum() == 0
      assert (df["col4"] != 4).sum() == 0
      assert (df["col5"] != 5).sum() == 0
      # Weekly aggregation
      df = dl.get_aggregated_data(
          test_df, agg_freq="weekly", agg_func=agg_func
      )
      assert df.shape == (53, len(agg_func) + 1)
      assert (df["col1"] != 24 * 7 * 2).sum() == 2
      assert (df["col2"] != 2).sum() == 0
      assert (df["col3"] != 3).sum() == 0
      assert (df["col4"] != 4).sum() == 0
      assert (df["col5"] != 5).sum() == 0
      # Monthly aggregation
      df = dl.get_aggregated_data(
          test_df, agg_freq="monthly", agg_func=agg_func
      )
      assert df.shape == (12, len(agg_func) + 1)
      assert (
          df["col1"].isin([24 * 29 * 2, 24 * 30 * 2, 24 * 31 * 2])
      ).sum() == 12
      assert (df["col2"] != 2).sum() == 0
      assert (df["col3"] != 3).sum() == 0
      assert (df["col4"] != 4).sum() == 0
      assert (df["col5"] != 5).sum() == 0
  
      df = test_df.drop(columns=[TIME_COL])
      with pytest.raises(ValueError, match=f"{TIME_COL}"):
          dl.get_aggregated_data(
              df, agg_freq="monthly", agg_func=agg_func
          )
  
imports: import os
  import re
  import pandas
  import pytest
  from greykite.common.constants import TIME_COL
  from greykite.common.data_loader import DataLoader
  from greykite.common.testing_utils import assert_equal
label_desc: Use image node_id 4 for calling a global function with example usage: test_get_aggregated_data() without return types