>> df = hc.createDataFrame([('a', [1.0, 1.0]), ('a',[1.0, 0.2,0.3,0.7]), ('b', [1.0]),('c' ,[1.0, 0.5]), ('d', [0.55, 1.0,1.4]),('e', [1.05, 1.0])])
>> df.show()
+---+--------------------+
| _1| _2|
+---+--------------------+
| a| [1.0, 1.0]|
| a|[1.0, 0.2, 0.3, 0.7]|
| b| [1.0]|
| c| [1.0, 0.5]|
| d| [0.55, 1.0, 1.4]|
| e| [1.05, 1.0]|
+---+--------------------+
Now, I want to apply a function like a sum or mean on the column, "_2" to create a column, "_3" For example, I created a column using the sum function The result should look like below
+---+--------------------+----+
| _1| _2| _3|
+---+--------------------+----+
| a| [1.0, 1.0]| 2.0|
| a|[1.0, 0.2, 0.3, 0.7]| 2.2|
| b| [1.0]| 1.0|
| c| [1.0, 0.5]| 1.5|
| d| [0.55, 1.0, 1.4]|2.95|
| e| [1.05, 1.0]|2.05|
+---+--------------------+----+
Thanks in advance