I'm trying to aggregate data. It works below.
| name | id | day | value |
|---|---|---|---|
| ken | 01 | 02-01 | good |
| ken | 01 | 02-02 | error |
spark_df
spark_df.groupBy("name", "id").\
agg(func.collect_list(func.create_map(func.col("day"),func.col("value)))).alias("day_val"))
I could aggregate day_val data as list of map. Like this
[{"day1":"value1"},{"day2":"value2"},{"day3":"value3"},....]
But I want to save it as
{"day1":"value1","day2":"value2","day3":"value3"}
Because on dynamodb I want to use it as not list but map. Can I convert it to array or aggregate it as map?
Thank you.