title: create array of columns in pyspark
body: <p>I have a dataframe with single row and multiple columns. I would like it to convert it into multiple rows.
  I had found a similar question <a href="https://stackoverflow.com/questions/61469585/transpose-dataframe-single-row-to-column-in-spark-with-scala">here</a> on the stackoverflow.</p>
  <p>The question answers how it can be done in scala but I wanted to do this in pyspark. I tried to replicate the code in pyspark but I wasn't able to do that.</p>
  <p>I am not able to convert the below code in scala to python:</p>
  <pre class="lang-scala prettyprint-override"><code>import org.apache.spark.sql.Column
  var ColumnsAndValues: Array[Column] = df.columns.flatMap { c =&gt; {Array(lit(c), col(c))}}
  val df2 = df1.withColumn(&quot;myMap&quot;, map(ColumnsAndValues: _*))
  </code></pre>