I want to create a array column from existing column in PySpark
--------------------------
col0 | col1 | col2 | col3
--------------------------
1 |a |b |c
--------------------------
2 |d |e |f
--------------------------
I want like this
-------------
col0 | col1
-------------
1 |[a,b,c]
-------------
2 |[d,e,f]
--------------
I was trying array() function like this
>>> new = df.select("col0",array("col1","col2","col3").alias("col1"))
but getting this error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'list' object is not callable
Please if anyone have solution on this ..