code: def test_apply_with_new_dataframe(self):
      pdf = pd.DataFrame(
          {
              "timestamp": [0.0, 0.5, 1.0, 0.0, 0.5],
              "car_id": ["A", "A", "A", "B", "B"],
          }
      )
      psdf = ps.from_pandas(pdf)
  
      self.assert_eq(
          psdf.groupby("car_id")
          .apply(lambda _: pd.DataFrame({"column": [0.0]}))
          .sort_index(),
          pdf.groupby("car_id")
          .apply(lambda _: pd.DataFrame({"column": [0.0]}))
          .sort_index(),
      )
  
      self.assert_eq(
          psdf.groupby("car_id")
          .apply(
              lambda df: pd.DataFrame(
                  {"mean": [df["timestamp"].mean()]}
              )
          )
          .sort_index(),
          pdf.groupby("car_id")
          .apply(
              lambda df: pd.DataFrame(
                  {"mean": [df["timestamp"].mean()]}
              )
          )
          .sort_index(),
      )
  
      # dataframe with 1000+ records
      pdf = pd.DataFrame(
          {
              "timestamp": [0.0, 0.5, 1.0, 0.0, 0.5] * 300,
              "car_id": ["A", "A", "A", "B", "B"] * 300,
          }
      )
      psdf = ps.from_pandas(pdf)
  
      self.assert_eq(
          psdf.groupby("car_id")
          .apply(lambda _: pd.DataFrame({"column": [0.0]}))
          .sort_index(),
          pdf.groupby("car_id")
          .apply(lambda _: pd.DataFrame({"column": [0.0]}))
          .sort_index(),
      )
  
      self.assert_eq(
          psdf.groupby("car_id")
          .apply(
              lambda df: pd.DataFrame(
                  {"mean": [df["timestamp"].mean()]}
              )
          )
          .sort_index(),
          pdf.groupby("car_id")
          .apply(
              lambda df: pd.DataFrame(
                  {"mean": [df["timestamp"].mean()]}
              )
          )
          .sort_index(),
      )
  
imports: import unittest
  import numpy
  import pandas
  from pyspark import pandas
  from pyspark.pandas.config import option_context
  from pyspark.testing.pandasutils import ComparisonTestBase
  from pyspark.testing.sqlutils import SQLTestUtils
label_desc: Use image node_id 5 for calling the GroupbyApplyFuncMixin obj's underlying member method code with example usage: obj.test_apply_with_new_dataframe() without return types