title: Sum columns of a dataset
body: <p>I'm working in PySpark and I have a dataset like this :</p>
  <p><a href="https://i.stack.imgur.com/INczW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/INczW.png" alt="enter image description here" /></a></p>
  <p>I want to create a new df like this with the corresponding sums :</p>
  <p><a href="https://i.stack.imgur.com/iqy8e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iqy8e.png" alt="enter image description here" /></a></p>
  <p>So I tried this code :</p>
  <pre><code>
      df = df.withColumnRenamed(&quot;month_actual_january&quot;, &quot;monthjanuary&quot;)
      fin=df.groupBy([&quot;column1&quot;,&quot;column2&quot;]).sum()
  
  </code></pre>
  <p>The problem is that I get the following error :</p>
  <p><code> Attribute sum(column3) contains an invalid character among  ,;{}()\n\t=. Please use an alias to rename it</code></p>
  <p>Do you know how to fix this error ? Thanks !</p>