Get list of data types from schema in Apache Spark
<p>I have the following code in Spark-Python to get the list of names from the schema of a DataFrame, which works fine, but how can I get the list of the data types?</p>

<pre><code>columnNames = df.schema.names
</code></pre>

<p>For example, something like: </p>

<pre><code>columnTypes = df.schema.types
</code></pre>

<p>Is there any way to get a separate list of the data types contained in a DataFrame schema?</p>