code: def test_resample_timeseries_dataframe_modes(self):
      data = {
          "data": [1, 2, 3],
          "datetime": [
              "2020-11-09T08",
              "2020-11-09T09",
              "2020-11-09T11",
          ],
      }
      df = pd.DataFrame(data)
      df["datetime"] = pd.to_datetime(df["datetime"])
      res_df = resample_timeseries_dataframe(
          df,
          dt_col="datetime",
          interval="2H",
          start_time="2020-11-09T07",
          end_time="2020-11-09T10",
          merge_mode="max",
      )
      assert (
          np.isnan(res_df["data"][0])
          and res_df["data"][1] == 2
          and res_df["data"][2] == 3
      )
      res_df = resample_timeseries_dataframe(
          df,
          dt_col="datetime",
          interval="2H",
          start_time="2020-11-09T07",
          end_time="2020-11-09T10",
          merge_mode="min",
      )
      assert (
          np.isnan(res_df["data"][0])
          and res_df["data"][1] == 1
          and res_df["data"][2] == 3
      )
      res_df = resample_timeseries_dataframe(
          df,
          dt_col="datetime",
          interval="2H",
          start_time="2020-11-09T07",
          end_time="2020-11-09T10",
          merge_mode="mean",
      )
      assert (
          np.isnan(res_df["data"][0])
          and res_df["data"][1] == 1.5
          and res_df["data"][2] == 3
      )
      res_df = resample_timeseries_dataframe(
          df,
          dt_col="datetime",
          interval="2H",
          start_time="2020-11-09T07",
          end_time="2020-11-09T10",
          merge_mode="sum",
      )
      assert (
          np.isnan(res_df["data"][0])
          and res_df["data"][1] == 3
          and res_df["data"][2] == 3
      )
  
file_path: analytics-zoo/pyzoo/test/zoo/chronos/data/utils/test_resample.py
imports: import pytest
  import pandas
  import numpy
  from test.zoo.pipeline.utils.test_utils import ZooTestCase
  from zoo.chronos.data.utils.resample import resample_timeseries_dataframe
label_desc: Use image node_id 4 for calling the TestResampleTimeSeries obj's underlying member method code with example usage: obj.test_resample_timeseries_dataframe_modes() without return types