title: Convert schema of a Spark DataFrame to another DataFrame
body: <p>I have a Spark DataFrame on PySpark and I want to store its schema into another Spark DataFrame. </p>
  
  <p>For example:
  I have a sample DataFrame <code>df</code> that looks like - </p>
  
  <pre><code>+---+-------------------+
  | id|                  v|
  +---+-------------------+
  |  0| 0.4707538108432022|
  |  0|0.39170676690905415|
  |  0| 0.8249512619546295|
  |  0| 0.3366111661094958|
  |  0| 0.8974360488327017|
  +---+-------------------+
  </code></pre>
  
  <p>I can look out at the schema of <code>df</code> by doing - </p>
  
  <pre><code>df.printSchema()
  
  root
   |-- id: integer (nullable = true)
   |-- v: double (nullable = false)
  </code></pre>
  
  <p>What I require is a DataFrame that displays above information on <code>df</code> in two columns <code>col_name</code> and <code>dtype</code>. </p>
  
  <p>Expected Output:</p>
  
  <pre><code>+---------+-------------------+
  | col_name|              dtype|
  +---------+-------------------+
  |       id|            integer|
  |        v|             double|
  +---------+-------------------+
  </code></pre>
  
  <p>How do I achieve this? I cannot find anything regarding this. Thanks.</p>