title: How to resolve error "AttributeError: 'SparkSession' object has no attribute 'serializer'?
body: <p>I'm using pyspark dataframe. I have some code in which I'm trying to convert the <code>dataframe</code> to an <code>rdd</code>, but I receive the following error:</p>
  
  <blockquote>
    <p>AttributeError: 'SparkSession' object has no attribute 'serializer'</p>
  </blockquote>
  
  <p>What can be the issue?</p>
  
  <pre><code>training, test = rescaledData.randomSplit([0.8, 0.2])
  nb = NaiveBayes(smoothing=1.0, modelType="multinomial")
  # Train a naive Bayes model.
  model = nb.fit(rescaledData)
  
  # Make prediction and test accuracy.
  predictionAndLabel = test.rdd.map(lambda p: (model.predict(p.features), p.label))
  accuracy = 1.0 * predictionAndLabel.filter(lambda pl: pl[0] == pl[1]).count() / test.count()
  print('model accuracy {}'.format(accuracy))
  </code></pre>
  
  <p>Does anyone have any insight to why the statement <code>test.rdd</code> causes an error? The dataframe contains <code>Row object of (label, features)</code>. </p>
  
  <p>Thanks</p>