title: Is it possible to cast multiple columns of a dataframe in pyspark?
body: <p>I have a multi-column pyspark dataframe, and I need to convert the string types to the correct types, for example:</p>
  <p>I'm doing like this currently</p>
  <pre><code>df = df.withColumn(col_name, col(col_name).cast('float') \
  .withColumn(col_id, col(col_id).cast('int') \
  .withColumn(col_city, col(col_city).cast('string') \
  .withColumn(col_date, col(col_date).cast('date') \
  .withColumn(col_code, col(col_code).cast('bigint')
  </code></pre>
  <p>is it possible to create a list with the types and pass it at once to all columns?</p>