I'm working in PySpark and I have a dataset like this :
I want to create a new df like this with the corresponding sums :
So I tried this code :
df = df.withColumnRenamed("month_actual_january", "monthjanuary")
fin=df.groupBy(["column1","column2"]).sum()
The problem is that I get the following error :
Attribute sum(column3) contains an invalid character among ,;{}()\n\t=. Please use an alias to rename it
Do you know how to fix this error ? Thanks !