title: Convert each row of a dataframe to string
body: <p>I am trying to generate hash code for dataframe using <code>hashlib.md5</code> in pyspark. It <em>only</em> accepts a string to generate hash code.</p>
  
  <p>I need to convert each row of a dataframe to string.</p>
  
  <p>I tried <code>concat_ws</code> function to concatenate all columns and make it as a string but no result. </p>
  
  <p>My dataframe has columns of <code>Id, name, marks</code></p>
  
  <p><strong>I tried:</strong></p>
  
  <pre><code>str=df.select(concat_ws("id","name","marks"))
  
  print(hashlib.md5(str.encode(encoding='utf_8', errors='strict')).hexdigest())
  </code></pre>
  
  <p><strong>I got this error:</strong></p>
  
  <pre><code>AttributeError: 'DataFrame' object has no attribute 'encode'
  </code></pre>