code: def test_deferred_with_groupby():
      # GH 12486
      # support deferred resample ops with groupby
      data = [
          ["2010-01-01", "A", 2],
          ["2010-01-02", "A", 3],
          ["2010-01-05", "A", 8],
          ["2010-01-10", "A", 7],
          ["2010-01-13", "A", 3],
          ["2010-01-01", "B", 5],
          ["2010-01-03", "B", 2],
          ["2010-01-04", "B", 1],
          ["2010-01-11", "B", 7],
          ["2010-01-14", "B", 3],
      ]
  
      df = DataFrame(data, columns=["date", "id", "score"])
      df.date = pd.to_datetime(df.date)
  
      def f_0(x):
          return x.set_index("date").resample("D").asfreq()
  
      msg = "DataFrameGroupBy.apply operated on the grouping columns"
      with tm.assert_produces_warning(FutureWarning, match=msg):
          expected = df.groupby("id").apply(f_0)
      msg = "DataFrameGroupBy.resample operated on the grouping columns"
      with tm.assert_produces_warning(FutureWarning, match=msg):
          result = (
              df.set_index("date").groupby("id").resample("D").asfreq()
          )
      tm.assert_frame_equal(result, expected)
  
      df = DataFrame(
          {
              "date": date_range(
                  start="2016-01-01", periods=4, freq="W"
              ),
              "group": [1, 1, 2, 2],
              "val": [5, 6, 7, 8],
          }
      ).set_index("date")
  
      def f_1(x):
          return x.resample("1D").ffill()
  
      msg = "DataFrameGroupBy.apply operated on the grouping columns"
      with tm.assert_produces_warning(FutureWarning, match=msg):
          expected = df.groupby("group").apply(f_1)
      msg = "DataFrameGroupBy.resample operated on the grouping columns"
      with tm.assert_produces_warning(FutureWarning, match=msg):
          result = df.groupby("group").resample("1D").ffill()
      tm.assert_frame_equal(result, expected)
  
imports: from textwrap import dedent
  import numpy
  import pytest
  from pandas.compat import is_platform_windows
  import pandas
  from pandas import DataFrame, Index, Series, TimedeltaIndex, Timestamp
  import pandas._testing
  from pandas.core.indexes.datetimes import date_range
label_desc: Use image node_id 3 for calling a global function with example usage: test_deferred_with_groupby() and returns: x, x