class_docstr: Represents a Spark dataset (e.g. data derived from a Spark Table / file directory or Delta
  Table) for use with MLflow Tracking.
class_docstr_tok: ["Represents","a","Spark","dataset","(","e.g",".","data","derived","from","a","Spark","Table","\/","file","directory","or","Delta","Table",")","for","use","with","MLflow","Tracking","."]
docstr: Converts the Spark DataFrame to pandas and splits the resulting
  :py:class:`pandas.DataFrame` into: 1. a :py:class:`pandas.DataFrame` of features and
  2. a :py:class:`pandas.Series` of targets.
  
  To avoid overuse of driver memory, only the first 10,000 DataFrame rows are selected.
docstr_tok: ["Converts","the","Spark","DataFrame","to","pandas","and","splits","the","resulting",":","py",":","class",":","`","pandas.DataFrame","`","into",":","1.","a",":","py",":","class",":","`","pandas.DataFrame","`","of","features","and","2.","a",":","py",":","class",":","`","pandas.Series","`","of","targets",".","To","avoid","overuse","of","driver","memory",",","only","the","first","10,000","DataFrame","rows","are","selected","."]
code: def to_pyfunc(self) -> PyFuncInputsOutputs:
      """
      Converts the Spark DataFrame to pandas and splits the resulting
      :py:class:`pandas.DataFrame` into: 1. a :py:class:`pandas.DataFrame` of features and
      2. a :py:class:`pandas.Series` of targets.
  
      To avoid overuse of driver memory, only the first 10,000 DataFrame rows are selected.
      """
      df = self._df.limit(10000).toPandas()
      if self._targets is not None:
          if self._targets not in df.columns:
              raise MlflowException(
                  f"Failed to convert Spark dataset to pyfunc inputs and outputs because"
                  f" the pandas representation of the Spark dataset does not contain the"
                  f" specified targets column '{self._targets}'.",
                  # This is an internal error because we should have validated the presence of
                  # the target column in the Hugging Face dataset at construction time
                  INTERNAL_ERROR,
              )
          inputs = df.drop(columns=self._targets)
          outputs = df[self._targets]
          return PyFuncInputsOutputs(inputs=inputs, outputs=outputs)
      else:
          return PyFuncInputsOutputs(inputs=df, outputs=None)
  
imports: import json
  import logging
  from functools import cached_property
  from typing import TYPE_CHECKING, Any, Dict, Optional, Union
  from mlflow.data.dataset import Dataset
  from mlflow.data.dataset_source import DatasetSource
  from mlflow.data.delta_dataset_source import DeltaDatasetSource
  from mlflow.data.digest_utils import compute_spark_df_digest
  from mlflow.data.pyfunc_dataset_mixin import PyFuncConvertibleDatasetMixin, PyFuncInputsOutputs
  from mlflow.data.spark_dataset_source import SparkDatasetSource
  from mlflow.exceptions import MlflowException
  from mlflow.models.evaluation.base import EvaluationDataset
  from mlflow.protos.databricks_pb2 import INTERNAL_ERROR, INVALID_PARAMETER_VALUE
  from mlflow.types import Schema
  from mlflow.types.utils import _infer_schema
  from mlflow.utils.annotations import experimental
label_desc: Use image node_id 9 for calling the SparkDataset obj's underlying member method code with example usage: obj.to_pyfunc() and returns: PyFuncInputsOutputs, PyFuncInputsOutputs