title: How to convert a dataframe to a variable
body: <p>Is there any direct function to convert a dataframe and assign to a variable?
  For example below returns this</p>
  
  <pre><code>&gt;&gt;&gt; partitionRecordCount= spark.sql("select count(*) from mydb.mytable where partition_date="yyyymmdd")
  &gt;&gt;&gt; partitionRecordCount.show()
  
  +--------+
  |count(1)|
  +--------+
  |  206157|
  +--------+
  </code></pre>
  
  <hr>
  
  <p>what i need is like below</p>
  
  <pre><code>&gt;&gt;&gt; partitionRecordCount
  206157
  </code></pre>
  
  <p>I need that record count integer value directly in that variable on the left hand side  rather than a dataframe.  Please advice</p>