class_docstr: Convertor between RDD and Spark DataFrame.
class_docstr_tok: ["Convertor","between","RDD","and","Spark","DataFrame","."]
code: def collection_to_dataframe(
      self, col: pyspark.RDD, metric_output_columns: Sequence[str]
  ) -> SparkDataFrame:
      schema_fields = copy.deepcopy(self._partition_key_schema)
      float_type = pyspark.sql.types.DoubleType()
      for metric_column in metric_output_columns:
          schema_fields.append(
              pyspark.sql.types.StructField(
                  metric_column, float_type, nullable=False
              )
          )
      schema = pyspark.sql.types.StructType(schema_fields)
      return self._spark.createDataFrame(col, schema)
  
imports: import abc
  import copy
  from collections import namedtuple
  from dataclasses import dataclass
  from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union
  import pipeline_dp
  import pyspark
label_desc: Use image node_id 4 for calling the SparkConverter obj's underlying member method code with example usage: obj.collection_to_dataframe(col, metric_output_columns) and returns: self