title: How to fix 'DataFrame' object has no attribute 'coalesce'?
body: <p>In a PySpark application, I tried to transpose a dataframe by transforming it into pandas and then I want to write the result in csv file. This is how I am doing it:  </p>
  
  <pre><code>df = df.toPandas().set_index("s").transpose()
  df.coalesce(1).write.option("header", True).option("delimiter", ",").csv('dataframe')
  </code></pre>
  
  <p>When execution this script I get the following error:</p>
  
  <pre><code>'DataFrame' object has no attribute 'coalesce'
  </code></pre>
  
  <p>What is the problem? How can I fix it?</p>