@udf(returnType=MapType(StringType(), FloatType()))
def postprocess(data):
ret = dict()
....
# insert key and values to dictionary from data
...
return ret
ret = postprocess(col('data'))
print(ret) # Column<'postprocess(data)'>
I would like to create multiple columns from dictionary column.
If ret has {"key1": 0.1, "key2": 0.3}, the result should be
| key1 | key2 |
| 0.1 | 0.3 |
How can I create it?