Here is my dataframe:
my_df.show()
+----------+
| features|
+----------+
| [0,'a'] |
| [1,'b'] |
| [0,'c'] |
| [1,'d'] |
| [2,'e'] |
| [0,'f'] |
+----------+
how to convert it into a dataframe of tuples (with single column 'features')?
Here is my dataframe:
my_df.show()
+----------+
| features|
+----------+
| [0,'a'] |
| [1,'b'] |
| [0,'c'] |
| [1,'d'] |
| [2,'e'] |
| [0,'f'] |
+----------+
how to convert it into a dataframe of tuples (with single column 'features')?
Try
my_df.map(lambda x: (x[0],x[1]))