I have a pyspark dataframe df
+------------+------+
| timestamp | days |
+------------+------+
| 2019-11-21 | 5 |
| 2019-10-22 | 21 |
| ... | ... |
+------------+------+
I want to subtract the days from the timestamp with
import pyspark.sql.functions as F
df.withColumn("timestamp", F.date_add(F.col("timestamp"), -F.col("days")))
Expected result would be
+------------+------+
| timestamp | days |
+------------+------+
| 2019-11-16 | 5 |
| 2019-10-01 | 21 |
| ... | ... |
+------------+------+
But I only get an error TypeError: Column is not iterable
Is there a way to get this to work?