class_docstr: Spark related features. Usually, the features here are missing in pandas
  but Spark has it.
class_docstr_tok: ["Spark","related","features",".","Usually",",","the","features","here","are","missing","in","pandas","but","Spark","has","it","."]
docstr: Write the DataFrame out to a Spark data source.
  
  Parameters
  ----------
  path : string, optional
      Path to the data source.
  format : string, optional
      Specifies the output data source format. Some common ones are:
  
      - 'delta'
      - 'parquet'
      - 'orc'
      - 'json'
      - 'csv'
  mode : str {'append', 'overwrite', 'ignore', 'error', 'errorifexists'}, default
      'overwrite'. Specifies the behavior of the save operation when data already exists.
  
      - 'append': Append the new data to existing data.
      - 'overwrite': Overwrite existing data.
      - 'ignore': Silently ignore this operation if data already exists.
      - 'error' or 'errorifexists': Throw an exception if data already exists.
  partition_cols : str or list of str, optional
      Names of partitioning columns
  index_col: str or list of str, optional, default: None
      Column names to be used in Spark to represent pandas-on-Spark's index. The index name
      in pandas-on-Spark is ignored. By default, the index is always lost.
  options : dict
      All other options passed directly into Spark's data source.
  
  Returns
  -------
  None
  
  See Also
  --------
  read_spark_io
  DataFrame.to_delta
  DataFrame.to_parquet
  DataFrame.to_table
  DataFrame.spark.to_spark_io
  
  Examples
  --------
  >>> df = ps.DataFrame(dict(
  ...    date=list(pd.date_range('2012-1-1 12:00:00', periods=3, freq='M')),
  ...    country=['KR', 'US', 'JP'],
  ...    code=[1, 2 ,3]), columns=['date', 'country', 'code'])
  >>> df
                   date country  code
  0 2012-01-31 12:00:00      KR     1
  1 2012-02-29 12:00:00      US     2
  2 2012-03-31 12:00:00      JP     3
  
  >>> df.spark.to_spark_io(path='%s/to_spark_io/foo.json' % path, format='json')
docstr_tok: ["Write","the","DataFrame","out","to","a","Spark","data","source",".","Parameters","--","--","--","--","--","path",":","string",",","optional","Path","to","the","data","source",".","format",":","string",",","optional","Specifies","the","output","data","source","format",".","Some","common","ones","are",":","-","'delta'","-","'parquet'","-","'orc'","-","'json'","-","'csv'","mode",":","str","{","'append","'",",","'overwrite","'",",","'ignore","'",",","'error","'",",","'errorifexists","'","}",",","default","'overwrite","'",".","Specifies","the","behavior","of","the","save","operation","when","data","already","exists",".","-","'append","'",":","Append","the","new","data","to","existing","data",".","-","'overwrite","'",":","Overwrite","existing","data",".","-","'ignore","'",":","Silently","ignore","this","operation","if","data","already","exists",".","-","'error","'","or","'errorifexists","'",":","Throw","an","exception","if","data","already","exists",".","partition_cols",":","str","or","list","of","str",",","optional","Names","of","partitioning","columns","index_col",":","str","or","list","of","str",",","optional",",","default",":","None","Column","names","to","be","used","in","Spark","to","represent","pandas-on-Spark","'s","index",".","The","index","name","in","pandas-on-Spark","is","ignored",".","By","default",",","the","index","is","always","lost",".","options",":","dict","All","other","options","passed","directly","into","Spark","'s","data","source",".","Returns","--","--","--","-","None","See","Also","--","--","--","--","read_spark_io","DataFrame.to_delta","DataFrame.to_parquet","DataFrame.to_table","DataFrame.spark.to_spark_io","Examples","--","--","--","--",">",">",">","df","=","ps.DataFrame","(","dict","(","...","date=list","(","pd.date_range","(","'2012-1-1","12:00:00","'",",","periods=3",",","freq='M","'",")",")",",","...","country=","[","'KR","'",",","'US","'",",","'JP","'","]",",","...","code=","[","1",",","2",",3","]",")",",","columns=","[","'date","'",",","'country","'",",","'code","'","]",")",">",">",">","df","date","country","code","0","2012-01-31","12:00:00","KR","1","1","2012-02-29","12:00:00","US","2","2","2012-03-31","12:00:00","JP","3",">",">",">","df.spark.to_spark_io","(","path=","'","%","s\/to_spark_io\/foo.json","'","%","path",",","format='json","'",")"]
code: def to_spark_io(
      self,
      path: Optional[str] = None,
      format: Optional[str] = None,
      mode: str = "overwrite",
      partition_cols: Optional[Union[str, List[str]]] = None,
      index_col: Optional[Union[str, List[str]]] = None,
      **options: "OptionalPrimitiveType",
  ) -> None:
      """Write the DataFrame out to a Spark data source.
  
      Parameters
      ----------
      path : string, optional
          Path to the data source.
      format : string, optional
          Specifies the output data source format. Some common ones are:
  
          - 'delta'
          - 'parquet'
          - 'orc'
          - 'json'
          - 'csv'
      mode : str {'append', 'overwrite', 'ignore', 'error', 'errorifexists'}, default
          'overwrite'. Specifies the behavior of the save operation when data already exists.
  
          - 'append': Append the new data to existing data.
          - 'overwrite': Overwrite existing data.
          - 'ignore': Silently ignore this operation if data already exists.
          - 'error' or 'errorifexists': Throw an exception if data already exists.
      partition_cols : str or list of str, optional
          Names of partitioning columns
      index_col: str or list of str, optional, default: None
          Column names to be used in Spark to represent pandas-on-Spark's index. The index name
          in pandas-on-Spark is ignored. By default, the index is always lost.
      options : dict
          All other options passed directly into Spark's data source.
  
      Returns
      -------
      None
  
      See Also
      --------
      read_spark_io
      DataFrame.to_delta
      DataFrame.to_parquet
      DataFrame.to_table
      DataFrame.spark.to_spark_io
  
      Examples
      --------
      >>> df = ps.DataFrame(dict(
      ...    date=list(pd.date_range('2012-1-1 12:00:00', periods=3, freq='M')),
      ...    country=['KR', 'US', 'JP'],
      ...    code=[1, 2 ,3]), columns=['date', 'country', 'code'])
      >>> df
                       date country  code
      0 2012-01-31 12:00:00      KR     1
      1 2012-02-29 12:00:00      US     2
      2 2012-03-31 12:00:00      JP     3
  
      >>> df.spark.to_spark_io(path='%s/to_spark_io/foo.json' % path, format='json')
      """
      if (
          "options" in options
          and isinstance(options.get("options"), dict)
          and len(options) == 1
      ):
          options = options.get("options")  # type: ignore[assignment]
  
      self._psdf.spark.frame(index_col=index_col).write.save(
          path=path,
          format=format,
          mode=mode,
          partitionBy=partition_cols,
          **options,
      )
  
imports: from abc import ABCMeta, abstractmethod
  from typing import TYPE_CHECKING, Callable, Generic, List, Optional, Union
  from pyspark import StorageLevel
  from pyspark.sql import Column, DataFrame
  from pyspark.sql.types import DataType, StructType
  from pyspark.pandas._typing import IndexOpsLike
  from pyspark.pandas.internal import InternalField
  from pyspark.sql.utils import get_column_class, get_dataframe_class
label_desc: Use image node_id 9 for calling the SparkFrameMethods obj's underlying member method code with example usage: obj.to_spark_io(path, format, mode, partition_cols, index_col) without return types