title: How to change a dataframe column from String type to Double type in PySpark?
body: <p>I have a dataframe with column as String.
  I wanted to change the column type to Double type in PySpark.</p>
  
  <p>Following is the way, I did:</p>
  
  <pre><code>toDoublefunc = UserDefinedFunction(lambda x: x,DoubleType())
  changedTypedf = joindf.withColumn("label",toDoublefunc(joindf['show']))
  </code></pre>
  
  <p>Just wanted to know, is this the right way to do it as while running
  through Logistic Regression, I am getting some error, so I wonder,
  is this the reason for the trouble.</p>