title: Pyspark error on creating dataframe: 'StructField' object has no attribute 'encode'
body: <p>I'm facing a little issue when creating a dataframe:</p>
  
  <pre><code>from pyspark.sql import SparkSession, types
  
  spark = SparkSession.builder.appName('test').getOrCreate()
  
  df_test = spark.createDataFrame(
      ['a string', 1],
      schema = [
          types.StructField('col1', types.StringType(), True),
          types.StructField('col2', types.IntegerType(), True)
      ]
  )
  
  ## AttributeError: 'StructField' object has no attribute 'encode'
  </code></pre>
  
  <p>I don't see anything wrong with my code (it's so simple I feel really dumb). But I can't get this to work. Can you point me in the right direction?</p>