I have following values in spark dataframe
+---------+------+----+----------+-----------+-----------+--------------+
|store_nbr|metric|goal|time_frame|time_period|fiscal_year| channel|
+---------+------+----+----------+-----------+-----------+--------------+
| 1000| NPS| 53| Half Year| H1| 2023| store|
| 1001| NPS| 81| Half Year| H1| 2023|ecomm_combined|
| 1003| NPS| 65| Half Year| H1| 2023|ecomm_combined|
| 1004| NPS| 85| Half Year| H1| 2023| store|
| 1007| NPS| 53| Half Year| H1| 2023| store|
| 1008| NPS|null| Half Year| H1| 2023| store|
| 1009| NPS| 85| Half Year| H1| 2023| store|
| 1011| NPS| 72| Half Year| H1| 2023| store|
| 1012| NPS| 71| Half Year| H1| 2023|ecomm_combined|
| 1013| NPS| 52| Half Year| H1| 2023|ecomm_combined|
| 1014| NPS|null| Half Year| H1| 2023|ecomm_combined|
| 1016| NPS| 54| Half Year| H1| 2023|ecomm_combined|
| 1017| NPS| 69| Half Year| H1| 2023|ecomm_combined|
| 1018| NPS| 93| Half Year| H1| 2023|ecomm_combined|
| 1020| NPS| 93| Half Year| H1| 2023| store|
| 1022| NPS| 95| Half Year| H1| 2023| store|
| 1023| NPS| 86| Half Year| H1| 2023|ecomm_combined|
| 1025| NPS| 72| Half Year| H1| 2023|ecomm_combined|
| 1026| NPS| 70| Half Year| H1| 2023|ecomm_combined|
| 1027| NPS|null| Half Year| H1| 2023|ecomm_combined|
| 1028| NPS| 63| Half Year| H1| 2023|ecomm_combined|
| 1029| NPS| 66| Half Year| H1| 2023|ecomm_combined|
| 1030| NPS| 86| Half Year| H1| 2023|ecomm_combined|
| 1031| NPS| 61| Half Year| H1| 2023|ecomm_combined|
| 1032| NPS| 96| Half Year| H1| 2023|ecomm_combined|
| 1033| NPS| 91| Half Year| H1| 2023|ecomm_combined|
| 1034| NPS| 79| Half Year| H1| 2023|ecomm_combined|
| 1035| NPS| 53| Half Year| H1| 2023|ecomm_combined|
| 1036| NPS|null| Half Year| H1| 2023| store|
and my average calculation dataframe looks like -
goal = raw_df.groupBy('metric','time_frame', 'time_period','fiscal_year','channel').mean('goal')
+------+----------+-----------+-----------+--------------+-----------------+
|metric|time_frame|time_period|fiscal_year| channel| avg(goal)|
+------+----------+-----------+-----------+--------------+-----------------+
| null| null| null| null| null| null|
| NPS| Half Year| H1| 2023|ecomm_combined|75.24033149171271|
| NPS| Half Year| H1| 2023| store| 78.0|
+------+----------+-----------+-----------+--------------+-----------------+
So I want to insert this calculated avg value for goal column in raw_df data where there is null in that column(data type doesn't matter) .Group by metric, time_frame, time_period, fiscal_year, channel these columns. How can I do this in Spark or may in Pandas dataframe.