code: def test_groupby_agg():
      df = pd.DataFrame(
          {
              "date": [
                  "20190101",
                  "20190101",
                  "20190102",
                  "20190102",
                  "20190304",
                  "20190304",
              ],
              "values": [1, 1, 2, 2, 3, 3],
          }
      )
  
      df_new = df.groupby_agg(
          by="date",
          new_column_name="date_average",
          agg_column_name="values",
          agg=np.mean,
      )
      assert df.shape[0] == df_new.shape[0]
      assert "date_average" in df_new.columns
      assert df_new["date_average"].iloc[0] == 1
  
file_path: pyjanitor/tests/functions/test_groupby_agg.py
imports: import numpy
  import pandas
  import pytest
  from pandas.testing import assert_frame_equal
label_desc: Use image node_id 1 for calling a global function with example usage: test_groupby_agg() without return types