code: def _createFromLocal(self, data, schema):
          
          # make sure data could consumed multiple times
          if not isinstance(data, list):
              data = list(data)
  
          if schema is None or isinstance(schema, (list, tuple)):
              struct = self._inferSchemaFromList(data, names=schema)
              converter = _create_converter(struct)
              data = map(converter, data)
              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)
  
          # convert python objects to sql data
          data = [schema.toInternal(row) for row in data]
          return self._sc.parallelize(data), schema
docs: Create an RDD for DataFrame from a list or pandas.DataFrame, returns
          the RDD and schema.