code: def apply(
      self, udf: "GroupedMapPandasUserDefinedFunction"
  ) -> "DataFrame":
      # Columns are special because hasattr always return True
      if (
          isinstance(udf, Column)
          or not hasattr(udf, "func")
          or (
              udf.evalType  # type: ignore[attr-defined]
              != PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF
          )
      ):
          raise PySparkTypeError(
              error_class="INVALID_UDF_EVAL_TYPE",
              message_parameters={
                  "eval_type": "SQL_GROUPED_MAP_PANDAS_UDF"
              },
          )
  
      warnings.warn(
          "It is preferred to use 'applyInPandas' over this "
          "API. This API will be deprecated in the future releases. See SPARK-28264 for "
          "more details.",
          UserWarning,
      )
  
      return self.applyInPandas(udf.func, schema=udf.returnType)
  
imports: from pyspark.sql.connect.utils import check_dependencies
  import warnings
  from typing import Any, Dict, List, Sequence, Union, TYPE_CHECKING, Optional, overload, cast
  from pyspark.rdd import PythonEvalType
  from pyspark.sql.group import GroupedData
  from pyspark.sql.pandas.group_ops import PandasCogroupedOps
  from pyspark.sql.types import NumericType
  from pyspark.sql.types import StructType
  import pyspark.sql.connect.plan
  from pyspark.sql.connect.column import Column
  from pyspark.sql.connect.functions.builtin import _invoke_function, col, lit
  from pyspark.errors import PySparkNotImplementedError, PySparkTypeError
label_desc: Use image node_id 13 for calling the GroupedData obj's underlying member method code with example usage: obj.apply(udf) and returns: self