I have an existing dataframe 'df' with a column 'list_len' and I want to create a column that consists of empty strings with length indicated by the value of 'list_len'.
I tried to do df.withColumn('new_list', array(['']*col('list_len'))).show() in pyspark but it did not work.
any idea/help is greatly appreciated!
+---------+------------------+
|list_len | new_list |
+---------+------------------+
| 1| ['']|
| 3| ['', '', '']|
| 2| ['', '']|
+----------------------------+