def _createFromRDD(self, rdd, schema, samplingRatio):
    '\n        Create an RDD for DataFrame from an existing RDD, returns the RDD and schema.\n        '
    if ((schema is None) or isinstance(schema, (list, tuple))):
        struct = self._inferSchema(rdd, samplingRatio)
        converter = _create_converter(struct)
        rdd = rdd.map(converter)
        if isinstance(schema, (list, tuple)):
            for (i, name) in enumerate(schema):
                struct.fields[i].name = name
                struct.names[i] = name
        schema = struct
    elif (not isinstance(schema, StructType)):
        raise TypeError(('schema should be StructType or list or None, but got: %s' % schema))
    rdd = rdd.map(schema.toInternal)
    return (rdd, schema)
Create an RDD for DataFrame from an existing RDD, returns the RDD and schema.
def _createFromRDD(self, rdd, schema, samplingRatio):
    '\n        \n        '
    if ((schema is None) or isinstance(schema, (list, tuple))):
        struct = self._inferSchema(rdd, samplingRatio)
        converter = _create_converter(struct)
        rdd = rdd.map(converter)
        if isinstance(schema, (list, tuple)):
            for (i, name) in enumerate(schema):
                struct.fields[i].name = name
                struct.names[i] = name
        schema = struct
    elif (not isinstance(schema, StructType)):
        raise TypeError(('schema should be StructType or list or None, but got: %s' % schema))
    rdd = rdd.map(schema.toInternal)
    return (rdd, schema)