title: 'RDD' object has no attribute '_jdf' pyspark RDD
body: <p>I'm new in pyspark. I would like to perform some machine Learning on a text file.</p>
  
  <pre><code>from pyspark import Row
  from pyspark.context import SparkContext
  from pyspark.sql.session import SparkSession
  from pyspark import SparkConf
  sc = SparkContext
  spark = SparkSession.builder.appName("ML").getOrCreate()
  
  train_data = spark.read.text("20ng-train-all-terms.txt")
  td= train_data.rdd #transformer df to rdd
  tr_data= td.map(lambda line: line.split()).map(lambda words: Row(label=words[0],words=words[1:]))
  from pyspark.ml.feature import CountVectorizer
  
  vectorizer = CountVectorizer(inputCol ="words", outputCol="bag_of_words")
  vectorizer_transformer = vectorizer.fit(td)
  </code></pre>
  
  <p>and for my last command, i obtain the error
  "AttributeError: 'RDD' object has no attribute '_jdf'</p>
  
  <p><a href="https://i.stack.imgur.com/PlBOI.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>can anyone help me please.
  thank you</p>